Reputation: 4560
I have below sql export from Microsoft SQL Sever
and I tried to import into Mysql
running by Apache
in osx. I got an Sql syntax error from line 1. I am new and I actually have never seen the sql using [ ]
as quote fot string.
Thank you very much for your adverses!!
Best regards,
USE [boatexpress]
GO
/****** Object: Schema [boatexpress] Script Date: 07/22/2013 14:15:07 ******/
CREATE SCHEMA [boatexpress] AUTHORIZATION [boatexpress]
GO
/****** Object: Table [dbo].[waybill111] Script Date: 07/22/2013 14:15:07 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[waybill111](
[id] [int] IDENTITY(1,1) NOT NULL,
[slAAECode] [nvarchar](100) NULL,
[slProductName] [ntext] NULL,
[slRecName] [nvarchar](50) NULL,
[slRecMobi] [nvarchar](50) NULL,
[slRecAddress] [nvarchar](255) NULL,
[slZipCode] [nvarchar](50) NULL,
[slweight] [float] NULL,
[ktype] [nvarchar](50) NULL,
[worth] [nvarchar](150) NULL,
[adminid] [int] NULL,
[addtime] [date] NULL,
[insurance] [nvarchar](50) NULL,
CONSTRAINT [PK_waybill] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
Upvotes: 0
Views: 134
Reputation: 7242
The syntax from SQL to MySQL is different. If you want to create above table use this syntax.
Create the database
CREATE SCHEMA `boatexpress` ;
Create the table
CREATE TABLE boatexpress.waybill111 (
`id` int PRIMARY KEY AUTO_INCREMENT NOT NULL,
`slAAECode` nvarchar(100) NULL,
`slProductName` text NULL,
`slRecName` nvarchar(50) NULL,
`slRecMobi` nvarchar(50) NULL,
`slRecAddress` nvarchar (255) NULL,
`slZipCode` nvarchar(50) NULL,
`slweight` float NULL,
`ktype` nvarchar(50) NULL,
`worth` nvarchar(150) NULL,
`adminid` int NULL,
`addtime` date NULL,
`insurance` nvarchar(50) NULL);
Datatypes like ntext doesnt exists in MySQL. I just renamed it to TEXT
. Also []
are not used to wrap columns but ` is. For datatypes you dont need to enclose them at all.
Is this what you are looking for?
Also, your SQL code is actually trying to use boatexpress before creating it.
Upvotes: 1