With a recent project, I’ve had to reproduce a table from a Microsoft SQL Database into a MySQL Database.
The table had lots of fields and would be very time consuming to write the SQL to create the table, but luckily I came across this tool to convert MSSQL to MySQL
MS SQL:
CREATE TABLE [dbo].[CRONUS UK Ltd_$Customer]( [timestamp] [timestamp] NOT NULL, [No_] [varchar](20) NOT NULL, [Name] [varchar](50) NOT NULL, [Search Name] [varchar](50) NOT NULL, [Name 2] [varchar](50) NOT NULL, [Address] [varchar](50) NOT NULL, [Address 2] [varchar](50) NOT NULL, [City] [varchar](30) NOT NULL, [Contact] [varchar](50) NOT NULL, [Phone No_] [varchar](30) NOT NULL, [Telex No_] [varchar](20) NOT NULL, [Our Account No_] [varchar](20) NOT NULL, [Territory Code] [varchar](10) NOT NULL, [Global Dimension 1 Code] [varchar](20) NOT NULL, [Global Dimension 2 Code] [varchar](20) NOT NULL, [Chain Name] [varchar](10) NOT NULL, [Budgeted Amount] [decimal](38, 20) NOT NULL, [Credit Limit (LCY)] [decimal](38, 20) NOT NULL, [Customer Posting Group] [varchar](10) NOT NULL, [Currency Code] [varchar](10) NOT NULL, [Customer Price Group] [varchar](10) NOT NULL, [Language Code] [varchar](10) NOT NULL, [Statistics Group] [int] NOT NULL, [Payment Terms Code] [varchar](10) NOT NULL, [Fin_ Charge Terms Code] [varchar](10) NOT NULL, [Salesperson Code] [varchar](10) NOT NULL, [Shipment Method Code] [varchar](10) NOT NULL, [Shipping Agent Code] [varchar](10) NOT NULL, [Place of Export] [varchar](20) NOT NULL, [Invoice Disc_ Code] [varchar](20) NOT NULL, [Customer Disc_ Group] [varchar](10) NOT NULL, [Country_Region Code] [varchar](10) NOT NULL, [Collection Method] [varchar](20) NOT NULL, [Amount] [decimal](38, 20) NOT NULL, [Blocked] [int] NOT NULL, [Invoice Copies] [int] NOT NULL, [Last Statement No_] [int] NOT NULL, [Print Statements] [tinyint] NOT NULL, [Bill-to Customer No_] [varchar](20) NOT NULL, [Priority] [int] NOT NULL, [Payment Method Code] [varchar](10) NOT NULL, [Last Date Modified] [datetime] NOT NULL, [Application Method] [int] NOT NULL, [Prices Including VAT] [tinyint] NOT NULL, [Location Code] [varchar](10) NOT NULL, [Fax No_] [varchar](30) NOT NULL, [Telex Answer Back] [varchar](20) NOT NULL, [VAT Registration No_] [varchar](20) NOT NULL, [Combine Shipments] [tinyint] NOT NULL, [Gen_ Bus_ Posting Group] [varchar](10) NOT NULL, [Picture] [image] NULL, [Post Code] [varchar](20) NOT NULL, [County] [varchar](30) NOT NULL, [E-Mail] [varchar](80) NOT NULL, [Home Page] [varchar](80) NOT NULL, [Reminder Terms Code] [varchar](10) NOT NULL, [No_ Series] [varchar](10) NOT NULL, [Tax Area Code] [varchar](20) NOT NULL, [Tax Liable] [tinyint] NOT NULL, [VAT Bus_ Posting Group] [varchar](10) NOT NULL, [Reserve] [int] NOT NULL, [Block Payment Tolerance] [tinyint] NOT NULL, [IC Partner Code] [varchar](20) NOT NULL, [Prepayment %] [decimal](38, 20) NOT NULL, [Primary Contact No_] [varchar](20) NOT NULL, [Responsibility Center] [varchar](10) NOT NULL, [Shipping Advice] [int] NOT NULL, [Shipping Time] [varchar](32) NOT NULL, [Shipping Agent Service Code] [varchar](10) NOT NULL, [Service Zone Code] [varchar](10) NOT NULL, [Allow Line Disc_] [tinyint] NOT NULL, [Base Calendar Code] [varchar](10) NOT NULL, [Copy Sell-to Addr_ to Qte From] [int] NOT NULL, [Type of Supply Code] [varchar](10) NOT NULL, [Liq_ Payment Terms Code] [varchar](10) NOT NULL, CONSTRAINT [CRONUS UK Ltd_$Customer$0] PRIMARY KEY CLUSTERED ( [No_] 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
MySQL:
CREATE TABLE `CRONUS UK Ltd_$Customer`( `timestamp` `timestamp` NOT NULL, `No_` varchar(20) NOT NULL, `Name` varchar(50) NOT NULL, `Search Name` varchar(50) NOT NULL, `Name 2` varchar(50) NOT NULL, `Address` varchar(50) NOT NULL, `Address 2` varchar(50) NOT NULL, `City` varchar(30) NOT NULL, `Contact` varchar(50) NOT NULL, `Phone No_` varchar(30) NOT NULL, `Telex No_` varchar(20) NOT NULL, `Our Account No_` varchar(20) NOT NULL, `Territory Code` varchar(10) NOT NULL, `Global Dimension 1 Code` varchar(20) NOT NULL, `Global Dimension 2 Code` varchar(20) NOT NULL, `Chain Name` varchar(10) NOT NULL, `Budgeted Amount` decimal(38, 20) NOT NULL, `Credit Limit (LCY)` decimal(38, 20) NOT NULL, `Customer Posting Group` varchar(10) NOT NULL, `Currency Code` varchar(10) NOT NULL, `Customer Price Group` varchar(10) NOT NULL, `Language Code` varchar(10) NOT NULL, `Statistics Group` int NOT NULL, `Payment Terms Code` varchar(10) NOT NULL, `Fin_ Charge Terms Code` varchar(10) NOT NULL, `Salesperson Code` varchar(10) NOT NULL, `Shipment Method Code` varchar(10) NOT NULL, `Shipping Agent Code` varchar(10) NOT NULL, `Place of Export` varchar(20) NOT NULL, `Invoice Disc_ Code` varchar(20) NOT NULL, `Customer Disc_ Group` varchar(10) NOT NULL, `Country_Region Code` varchar(10) NOT NULL, `Collection Method` varchar(20) NOT NULL, `Amount` decimal(38, 20) NOT NULL, `Blocked` int NOT NULL, `Invoice Copies` int NOT NULL, `Last Statement No_` int NOT NULL, `Print Statements` `tinyint` NOT NULL, `Bill-to Customer No_` varchar(20) NOT NULL, `Priority` int NOT NULL, `Payment Method Code` varchar(10) NOT NULL, `Last Date Modified` datetime NOT NULL, `Application Method` int NOT NULL, `Prices Including VAT` `tinyint` NOT NULL, `Location Code` varchar(10) NOT NULL, `Fax No_` varchar(30) NOT NULL, `Telex Answer Back` varchar(20) NOT NULL, `VAT Registration No_` varchar(20) NOT NULL, `Combine Shipments` `tinyint` NOT NULL, `Gen_ Bus_ Posting Group` varchar(10) NOT NULL, `Picture` blob NULL, `Post Code` varchar(20) NOT NULL, `County` varchar(30) NOT NULL, `E-Mail` varchar(80) NOT NULL, `Home Page` varchar(80) NOT NULL, `Reminder Terms Code` varchar(10) NOT NULL, `No_ Series` varchar(10) NOT NULL, `Tax Area Code` varchar(20) NOT NULL, `Tax Liable` `tinyint` NOT NULL, `VAT Bus_ Posting Group` varchar(10) NOT NULL, `Reserve` int NOT NULL, `Block Payment Tolerance` `tinyint` NOT NULL, `IC Partner Code` varchar(20) NOT NULL, `Prepayment %` decimal(38, 20) NOT NULL, `Primary Contact No_` varchar(20) NOT NULL, `Responsibility Center` varchar(10) NOT NULL, `Shipping Advice` int NOT NULL, `Shipping Time` varchar(32) NOT NULL, `Shipping Agent Service Code` varchar(10) NOT NULL, `Service Zone Code` varchar(10) NOT NULL, `Allow Line Disc_` `tinyint` NOT NULL, `Base Calendar Code` varchar(10) NOT NULL, `Copy Sell-to Addr_ to Qte From` int NOT NULL, `Type of Supply Code` varchar(10) NOT NULL, `Liq_ Payment Terms Code` varchar(10) NOT NULL, CONSTRAINT `CRONUS UK Ltd_$Customer$0` PRIMARY KEY ( `No_` ASC ) ) ;
A simple find and replace in the new SQL to correct tinyint, and then the table can be easily created in the MySQL database.