How to convert mssql script to mysql

I tried to convert the script from MS SQL Server to MySql.

I could not find a convenient approach for this conversion.

I tried using this MS SQL Server to MySQL Conversion , but it has a lot of syntax errors.

ERROR 1064 (42000): 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 'IDENTITY(1,1) NOT NULL, `address` varchar(255) NOT NULL, `date_added` datetime N' at line 2 

Here is the contents of the file I need to convert pastebin - script

  • Is there a better way to do this conversion, but without installing a special tool?
+8
sql mysql sql-server
source share
2 answers

You do not just β€œconvert” TSQL to SQL for MySQL. You need to know different data types, column restrictions, etc. You are in the first of many roadblocks: MySQL uses AUTO_INCREMENT instead of limiting the SQL Server IDENTITY field.

EDIT: There are utilities, but you should still understand what changes are because they will affect many things (including performance and future development regarding the database). Duplicate of several other messages (deleted link deleted).

+3
source share

The converter at http://burrist.com/mstomy.php launches a set of regular expressions for conversion - the list of regular expressions is not exhaustive and can be changed as necessary. Ive added a few extra lines to the standard regular expressions, and now it creates a working version of your script until you start inserting data (this is done only by the structure, not the data). Hope this is interesting.

Cheers sql-hub.com

+1
source share

All Articles