MS SQL Server to MySQL Conversion

MS to MySQL

This tool allows you to convert a database creation script generated by MS SQL Server Enterprise Manager into a script that can be run to create the database on MySQL.

Paste the script into the box below and click 'convert'. This runs a series of replacements on the script converting the syntax between MS SQL and MySQL. You may well need to make further changes to the script (we've only added them as we've needed them), you can add extra replacements below - if you think things you have added might be of use to others or you'd like us to add something but aren't sure how to do it please get in touch: tools@burrist.co.uk.

SQL-Hub

You might be interested in out product SQL-Hub that allows you to merge multiple databases (including from a MSSQL source to a MySQL target) - SQL-Hub

Basics

To create and convert a database script: Go to the 'Tables' page for your database in MS SQL Enterprise Manager, select all the tables, right click, select 'All Tasks'->'Generate SQL Script'. In the formating tab, remove 'Generate the DROP command' and make sure 'Generate the CREATE command' is on. On the options tab, switch off all the 'Security Scripting Options', in the 'Table Scripting Options' you can select indexes and keys - this tool doesn't deal with triggers or full text indexes at the moment. Save or Preview the script and paste it below. Click 'convert' to convert the MS SQL script to MySQL. Copy and paste the MySQL script from the box at the bottom into a suitable program (e.g. MySQL Query Browser, PhpMyAdmin etc), create or select the database and run the script.

If there are errors when you run the script - first of all check whether they are really causing you any trouble - there may be 'multiple primary keys' errors that don't affect the creation of the database. If you can see how to fix the errors in the script edit the script manually or add a replacement below and run the conversion again - let us know when you add something that might be useful to others. See our products page for our other useful database tools, for viewing and querying databases, automatic merging of remote SQL and dbf databases and for transforming XML data into reports.

MS SQL Script

Replacements

The replacements are a series of Regular Expressions in the form ReplaceWithText@RegularExpression that are executed in order. You can edit the expressions here. If you need the expression to repeat until no further changes are made (make them 'recursive') add an extra @ at the end of the line. Let us know when you add something that might be useful to others.

MySQL Script