0

ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use n ear

at line 1

Am getting the error while using the following mysql statement. mysql -u root -p** < network.sql

MySQL Server version is 5.5.21

The content of network.sql file is

IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'server')
    DROP DATABASE [server]
GO

CREATE DATABASE [server]  ON (NAME = N'server', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL\Data\server.mdf' , SIZE = 1, FILEGROWTH = 10%) LOG ON (NAME = N'server_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL\Data\server_log.LDF' , FILEGROWTH = 10%)
 COLLATE SQL_Latin1_General_CP1_CI_AS
GO

exec sp_dboption N'server', N'autoclose', N'false'
GO

exec sp_dboption N'server', N'bulkcopy', N'false'
GO

exec sp_dboption N'server', N'trunc. log', N'false'
GO

exec sp_dboption N'server', N'torn page detection', N'true'
GO

exec sp_dboption N'server', N'read only', N'false'
GO

exec sp_dboption N'server', N'dbo use', N'false'
GO

exec sp_dboption N'server', N'single', N'false'
GO

exec sp_dboption N'server', N'autoshrink', N'false'
GO

exec sp_dboption N'server', N'ANSI null default', N'false'
GO

exec sp_dboption N'server', N'recursive triggers', N'false'
GO

exec sp_dboption N'server', N'ANSI nulls', N'false'
GO

exec sp_dboption N'server', N'concat null yields null', N'false'
GO

exec sp_dboption N'server', N'cursor close on commit', N'false'
GO

exec sp_dboption N'server', N'default to local cursor', N'false'
GO

exec sp_dboption N'server', N'quoted identifier', N'false'
GO

exec sp_dboption N'server', N'ANSI warnings', N'false'
GO

exec sp_dboption N'server', N'auto create statistics', N'true'
GO

exec sp_dboption N'server', N'auto update statistics', N'true'
GO

use [server]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Connection]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Connection]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[NodeInformation]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[NodeInformation]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[pda]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[pda]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[possibledelay]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[possibledelay]
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[possiblepath]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[possiblepath]
GO

CREATE TABLE [dbo].[Connection] (
    [NodeName] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [Neighbour] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [Cost] [decimal](10, 0) NULL ,
    [Delay] [decimal](18, 0) NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[NodeInformation] (
    [NodeName] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [PortNo] [int] NULL ,
    [SystemName] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, 
                [Status] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[NodeId] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[pda] (
    [path] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [cost] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [delay] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[node] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL  
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[possibledelay] (
    [destination] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [path] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [delay] [decimal](18, 0) NULL 
) ON [PRIMARY]
GO

CREATE TABLE [dbo].[possiblepath] (
    [destination] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [path] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
    [cost] [decimal](10, 0) NULL ,
    [delay] [decimal](18, 0) NULL 

) ON [PRIMARY]
GO
1
  • 1
    is this mysql? i don't think so. Commented Apr 12, 2012 at 13:16

2 Answers 2

3

The file you're trying to restore looks like a T-SQL file for MSSQL. So it won't work for MySQL. Not as-is, at least.

Sign up to request clarification or add additional context in comments.

1 Comment

could you please help me in restoring this database? Atleast describe me the tables inside.
0

First guess is it is picking up a line feed or cr from the text file and blowing up on that. If you can access the database from a windows box, try running the same command from query browser. Alternatively if it is a linux box, you can open the file in a text editor with all characters turned on and see where the extraneous character is coming in.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.