MSSQL 2 MySQL
Database Converter from Microsoft SQL Server to MySQL
|
| Download | ||
|
mssql2mysql.txt (current version 0.12, Mar 31st 2005; needs MySQL 4.1 or higher!)
mssql2mysql.0.10.txt (version 0.10, Nov 12th 2003 for MySQL 3.23 and 4.0) mssql2mysql.txt is a script file. To use it, you have to change a few lines of code. Other versions:
mssql2mysql is available for free.
| ||
| Features | ||
mssql2mysql has been tested using Microsoft SQL Server 7 + 2000, MySQL 3.23.28 / 4.0.4 / 5.0.2, Connector/ODBC 3.51 and Visual Basic 6 / VBA 6. Please note:
mssql2mysql seems to be able to correctly convert pubs, northwind and a number of sample databases of the author. I won't guarantee for the correctness of data, though. | ||
| Limitations | ||
| ||
| Requirements | ||
| ||
| Usage | ||
If you have VB6
If you have a VBA6 capable program
| ||
| Configuration | ||
mssql2mysql starts with a block of constants. Set the values of
these constants to configure the script.
' MSSQL login
Const MSSQL_SECURE_LOGIN = True 'login type (True for NT security)
Const MSSQL_LOGIN_NAME = "" 'login name (for NT security use "" here)
Const MSSQL_PASSWORD = "" 'password (for NT security use "" here)
Const MSSQL_HOST = "mars" 'hostname (if localhost: use "(local)")
Const MSSQL_DB_NAME = "pubs" 'database name
' mode
Const OUTPUT_TO_FILE = 0 '1 --> write file;
'0 --> connect to MySQL, execute SQL
' commands directly
'output file (only needed if OUTPUT_TO_FILE=1)
Const OUTPUT_FILENAME = "c:\export.sql"
'connect to MySQL (only needed if OUTPUT_TO_FILE=0)
Const MYSQL_USER_NAME = "root" 'login name
Const MYSQL_PASSWORD = "xxx" 'password
Const MYSQL_HOST = "hostname" 'if localhost: use "localhost"
Const MYSQL_PORT = 3306 'change if you use another port
Const MyODBCVersion = "MySQL" 'for MyODBC 2.51.*; if you use MyODBC 3.51*, use
'this setting instead: "MySQL ODBC 3.51 Driver"
' options
Const NEW_DB_NAME = "" 'name of new MySQL database ("" if same
' as MSSQL db name)
Const DROP_DATABASE = True 'begin with DROP dbname?
Const MAX_RECORDS = 0 'max. nr of records per table
'(0 for all records, n for testing purposes)
' new options in mssql2mysql 0.11 or higher
Const VARCHAR_MAX = 255 'max. no. of characters in VARCHAR
'255 for MySQL <= 5.0.2
'ca. 32000 for MySQL >= 5.0.3 (depends on char. set, max. 65535 bytes)
Const TABLE_ENGINE = "InnoDB" 'MyISAM or InnoDB
Const CHARSET = "utf8" 'character set for all text columns
Const COLLATION = "" 'collation; leave empty if you want to use the default collation for
'the specified character set
' old option for mssql2mysql 0.10 or lower (no longer needed in 0.11, see CHARSET)
Const UNICODE_TO_BLOB = False 'unicode -> BLOBs (True) or ANSI (False)
Some more details: MSSQL_SECURE_LOGIN (True/False) specifies whether mssql2mysql should use the NT/2000 security system to login at MSSQL. If this is True, neither username nor password need to be specified. DROP_DATABASE (True/False) specifies whether mssql2mysql should start by dropping the MySQL database of a previous conversion attempt (if one already exists). MAX_RECORDS (n) specifies how many records per table should be converted. 0 means all records. This option allows to do a quick check (i.e. MAX_RECORDS=10) before trying to convert the whole database (which may take some time and may give an error at the very last table). TABLE_ENGINE: Specifies the table type (MyISAM or InnoDB). CHARSET and COLLATION: Specify which characterset and collation should be used for all text columns. If COLLATION is empty, the default collation for the choosen charset is used. UNICODE_TO_BLOB (True/False) specifies how mssql2mysql 0.10 or lower should deal with unicode strings. True means, that Unicode columns are converted to BLOBs. (MySQL cannot order/sort BLOBs with unicode data, though!) If UNICODE_TO_BLOB is set to False, mssql2mysql converts Unicode strings to ANSI strings. This works fine if MSSQL contains ANSI data anyway. Otherwise, you will loose data! As of mssql2mysql 0.11, UNICODE_TO_BLOB is obsolete (see CHARSET). | ||
| History | ||
|
Version 0.01 (Jan. 18th 2001): initial version
Version 0.02 (June 23th 2001): better handling of decimal numbers, changes by dave.whitla-at-ocean.net.au Version 0.03 (August 7th 2001): compatibility with Office 97, changes by DaveMeaker-at-angelshade.com (uncomment Replace function at the end of the script!) Version 0.04 (September 30th 2001): slightly faster (ideas by janivar-at-acos.no) Version 0.05 (April 8 2002): compatible with MyODBC 3.51 (set variable MyODBCVersion accordingly!; thanks to Silvio Iaccarino) Version 0.05a (October 17 2002): support for BIGINT (thanks to Ugo Gioia) Version 0.06 (December 18 2002): support for adBinary (thanks to Roberto Alicata); new handling of TIMESTAMPs (Michael Kofler): TIMESTAMPs (MSSQL) are now converted to TINYBLOBs (MySQL) Version 0.07 (January 27 2003): allow specifiaction of MySQL Server port (Michael Kofler) Version 0.08 (April 27 2003): Boolean now converts to 1/0 instead of -1/0 for True/False (Michael Kofler) Version 0.09 (August 19 2003): better GUID conversion (thanks to Hermann Wiesner) Version 0.10 (November 12 2003): better handling of table and field names in function MySQLName (thanks to Carlo) Version 0.11 (Mar. 2nd 2005): needs MySQL 4.1 or higher! New
functions: Version 0.12 (Mar. 31st 2005): ignores hypothetical indexes (thanks to Brian K. Andersen) | ||
| GUI versions | ||
|
For those who don't want to deal with code directly, two user interfaces based on mssql2mysql are available. Both are based on Visual Basic 6. To run the programs, you need the VB6 runtime libraries including ADO 2.7. To change the programs, you need Visual Basic 6. If you don't meet these requirements, you are better off with the script version!
| ||
| MSACC2MySQL (converts from Microsoft Access to MySQL) | ||
|
Andre Steenveld (papa-at-catv2206-dot-extern-dot-kun-dot-nl) has adapted mssql2mysql for Microsoft Access. The resulting script is msacc2mysql.txt. Please see the script for further instructions. | ||
| Support | ||
| Sorry, mssql2mysql is not supported. | ||
| Links | ||
|
MySQL book written by Michael Kofler
(English translation). You will also find lot's of MySQL
internet links here.
MySQL Buch (original German edition) von Michael Kofler. Hier finden Sie auch eine Menge MySQL Internet-Links. | ||
| Home | ||
|
Back to the authors' homepage.
Zurück zur deutschen Homepage. | ||