Description:
Attempting to migrate from a MSSQL server 2005 to MySQL 5.0.51 (though produced schema does not load on 5.1.31 either) gives various issues. In this particular case about 16 out of 56 tables did not convert properly.
Source tables:
==================== tbl_060_PeopleDetails ====================
CREATE TABLE [dbo].[tbl_060_PeopleDetails](
[PeopDetID] [int] IDENTITY(1,1) NOT NULL,
[PeopDetBornDate] [datetime] NULL,
[PeopDetActDate] [datetime] NULL,
[PeopDetExpDate] [datetime] NULL,
[PersonID] [int] NOT NULL,
[AuthorID] [int] NOT NULL,
[PeopDetTypID] [int] NOT NULL,
[PeopDetRate] [decimal](18, 2) NULL,
[PeopDetName] [nvarchar](255) NULL,
[PeopDetDesc] [nvarchar](255) NULL,
[Deactivate] [bit] NULL,
CONSTRAINT [aaaaatbl_060_PeopleDetails_PK] PRIMARY KEY NONCLUSTERED
(
[PeopDetID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY =
OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
==================== tbl_620_MaterialsDet ====================
CREATE TABLE [dbo].[tbl_620_MaterialsDet](
[MaterialDetID] [int] IDENTITY(1,1) NOT NULL,
[MaterialID] [int] NOT NULL,
[VendorID] [int] NOT NULL,
[CopyrightStatus] [nvarchar](255) NOT NULL,
[PersonID] [int] NOT NULL,
[PersonAction] [nvarchar](255) NULL,
[Movement] [int] NULL,
[Inventory] [int] NULL,
[DetailDate] [datetime] NULL,
[Note] [ntext] NULL,
CONSTRAINT [aaaaatbl_620_MaterialsDet_PK] PRIMARY KEY NONCLUSTERED
(
[MaterialDetID] 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]
==================== tbl_200_Courses ====================
CREATE TABLE [dbo].[tbl_200_Courses](
[CourseID] [int] IDENTITY(1,1) NOT NULL,
[CourseCode] [nvarchar](12) NOT NULL,
[CourseDescription] [nvarchar](50) NOT NULL,
[CourseDescriptionNew] [nvarchar](50) NULL,
[CoursePrereqs] [bit] NOT NULL,
[CourseCredits] [float] NOT NULL,
[CourseTuition] [money] NOT NULL,
[CourseFee] [money] NOT NULL,
[ActivateOn] [datetime] NULL,
[DeactivateOn] [datetime] NULL,
[CourseActive] [bit] NOT NULL,
[CourseNotes] [ntext] NULL,
[CourseNotes2] [ntext] NULL,
[ReleaseID] [int] NOT NULL,
[DeanOwner] [int] NULL,
[ProgramOwner] [nvarchar](50) NULL,
[CourseArea] [nvarchar](255) NOT NULL,
[CourseLevel] [nvarchar](255) NOT NULL,
[HoursPerWeek] [int] NULL,
[CourseSequence] [int] NULL,
[DoNotRun] [bit] NULL,
CONSTRAINT [aaaaatbl_200_Courses_PK] PRIMARY KEY NONCLUSTERED
(
[CourseID] 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]
==================== tbl_201_CourseNotes ====================
CREATE TABLE [dbo].[tbl_201_CourseNotes](
[CourseNotesID] [int] IDENTITY(1,1) NOT NULL,
[CourseNotesDate] [datetime] NOT NULL,
[PersonID] [int] NOT NULL,
[CourseID] [int] NOT NULL,
[ReleaseID] [int] NOT NULL,
[CourseNotes] [ntext] NULL,
[HideNote] [bit] NOT NULL,
[NoteType] [nvarchar](255) NOT NULL,
CONSTRAINT [aaaaatbl_201_CourseNotes_PK] PRIMARY KEY NONCLUSTERED
(
[CourseNotesID] 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]
How to repeat:
Some examples of the resulting errors after conversion of the above listed source tables (notice error 2 and 4 are similar):
==================== tbl_060_PeopleDetails ====================
An error occured while executing the SQL statement.
You have an error in your SQL syntax; check the manual that corresponds
to your MySQL server version for the right syntax to use near '(0),
PRIMARY KEY (`PeopDetID`),
INDEX `AuthorID` (`AuthorID`),
INDEX `Peop' at line 12
==================== tbl_620_MaterialsDet ====================
An error occured while executing the SQL statement.
You have an error in your SQL syntax; check the manual that corresponds
to your MySQL server version for the right syntax to use near
'CONVERT([datetime],CONVERT([varchar],getdate(),(1)),(1)),
`Note` LONGTEXT NULL' at line 10
==================== tbl_200_Courses ====================
An error occured while executing the SQL statement.
You have an error in your SQL syntax; check the manual that corresponds
to your MySQL server version for the right syntax to use near '(0),
`CourseCredits` FLOAT(53) NOT NULL DEFAULT 3,
`CourseTuition` DECIMAL(1' at line 6
==================== tbl_201_CourseNotes ====================
An error occured while executing the SQL statement.
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CONVERT([datetime],CONVERT([varchar],getdate(),(1)),(1)),
`PersonID` INT(10) N' at line 3
This last error, when run manually:
Error Code : 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CONVERT([datetime],CONVERT([varchar],getdate(),(1)),(1)),
`PersonID` INT(10) N' at line 3
(0 ms taken)
Suggested fix:
Fix table conversions.
2 additional notes in regards errors 2 and 4:
o http://dev.mysql.com/doc/refman/5.1/en/data-type-defaults.html
'The DEFAULT clause specifies a default value for a column. With one
exception, the default value must be a constant; it cannot be a function
or an expression. This means, for example, that you cannot set the
default for a date column to be the value of a function.'
o Notice that for error 2 and 4 the issue is that the field in question has a millisecond format: 2006-03-02 00:00:00.000
This person is having a similar issue:
http://forums.mysql.com/read.php?60,162599,162599