MySQL to Microsoft SQL Server Migration

SQLines provides tools and services to help you transfer data, convert database schema (DDL), views, stored procedures and functions, triggers, queries, embedded SQL statements and SQL scripts from MySQL to Microsoft SQL Server.

We also help convert embedded SQL statements in C/C++ (ODBC, MySQL C API), C#, Java, PowerBuilder, VB/VB.NET, ASP/ASP.NET and Perl/PHP applications.

  • MySQL 5.x and 4.x
  • Microsoft SQL Server 2014, 2012, 2008 and 2005

MySQL to SQL Server Migration Tools

SQLines SQL Converter Tool

SQLines SQL Converter tool allows you to convert database schema (DDL), queries and DML statements, views, stored procedures, functions and triggers from MySQL to SQL Server.

SQLines tool converts SQL scripts and standalone SQL statements. To migrate data and database schema from a MySQL database use SQLines Data tool.

MySQL to Microsoft SQL Server Migration Reference

Technical information on migration from MySQL to Microsoft SQL Server.

Last Update: MySQL 5.6 and Microsoft SQL Server 2012


Converting identifiers:

MySQL SQL Server
Quoted Identifiers ` (backtick) and " (double quotes) [ ] and " (double quotes)

Data Types

Converting data types:

MySQL SQL Server
1 BIGINT 64-bit integer BIGINT
2 BINARY(n) Fixed-length byte string, 1 ⇐ n ⇐ 255 BINARY(n)
3 BIT(n) Fixed-length bit string, 1 ⇐ n ⇐ 64 BINARY(n/8)
4 BLOB(n) Binary large object, ⇐ 64K VARBINARY(max)
5 BOOLEAN, BOOL 0 or 1 value; NULL is not allowed BIT
6 CHAR(n), CHARACTER(n) Fixed-length string, 1 ⇐ n ⇐ 255 CHAR(n), CHARACTER(n)
7 CHARACTER VARYING(n) Variable-length string, 1 ⇐ n ⇐ 65535 CHARACTER VARYING(n)
8 DATE Date (year, month and day) DATE Since SQL Server 2008
9 DATETIME(p) Date and time data with fraction DATETIME2(p)
10 DECIMAL(p,s), DEC(p,s) Fixed-point number DECIMAL(p,s), DEC(p,s)
11 DOUBLE [PRECISION] Double-precision floating-point number FLOAT
12 FIXED(p,s) Fixed-point number DECIMAL(p,s)
13 FLOAT(p) Floating-point number FLOAT
14 FLOAT4(p) Floating-point number FLOAT
15 FLOAT8 Double-precision floating-point number BINARY_DOUBLE
16 INT, INTEGER 32-bit integer INT, INTEGER
17 INT1 8-bit integer SMALLINT
18 INT2 16-bit integer SMALLINT
19 INT3 24-bit integer INT
20 INT4 32-bit integer INT
21 INT8 64-bit integer BIGINT
22 LONGBLOB Binary large object, ⇐ 4G VARBINARY(max)
23 LONGTEXT Character large object, ⇐ 4G VARCHAR(max)
24 LONG VARBINARY Binary large object, ⇐ 16M VARBINARY(max)
25 LONG, LONG VARCHAR Character large object, ⇐ 16M VARCHAR(max)
26 MEDIUMBLOB Binary large object, ⇐ 16M VARBINARY(max)
27 MEDIUMINT 24-bit integer INT
28 MEDIUMTEXT Character large object, ⇐ 16M VARCHAR(max)
29 MIDDLEINT 24-bit integer INT
30 NCHAR(n) Fixed-length UTF-8 string, 1 ⇐ n ⇐ 255 NCHAR(n)
31 NVARCHAR(n) Varying-length UTF-8 string, 1 ⇐ n ⇐ 65535 NVARCHAR(n)
32 NUMERIC(p,s) Fixed-point number NUMERIC(p,s)
33 REAL Double-precision floating-point number DOUBLE PRECISION
34 SERIAL 64-bit autoincrementing integer NUMERIC(20)
35 SMALLINT 16-bit integer SMALLINT
36 TEXT Character large object, ⇐ 64K VARCHAR(max)
37 TIME(p) Time (Hour, minute, second and fraction) TIME(p)
38 TIMESTAMP(p) Auto-updated datetime DATETIME2(p)
39 TINYBLOB Binary data, ⇐ 255 bytes VARBINARY(255)
40 TINYINT 8-bit integer SMALLINT
41 TINYTEXT Character data, ⇐ 255 bytes VARCHAR(255)
42 VARBINARY(n) Variable-length byte string, 1 ⇐ n ⇐ 65535 VARBINARY(n)
43 VARCHAR(n) Variable-length string, 1 ⇐ n ⇐ 65535 VARCHAR(n)
44 YEAR[(2 | 4)] Year in 2-digit or 4-digit format NUMERIC(4)

Data Type Attributes:

MySQL SQL Server
Display width for integers INT(d) Not supported
UNSIGNED CHECK (col_name > 0)
COLLATE collate_name
CHARACTER SET charset_name
COMMENT 'string'
ON UPDATE clause for TIMESTAMP columns Not supported

Built-in SQL Functions

Converting functions:

MySQL SQL Server


Converting stored procedures from MySQL to SQL Server:

MySQL SQL Server
2 DEFINER = user Removed
3 IN | OUT | INOUT param datatype(len) Parameter definition @param datatype(len) OUT | OUTPUT
4 No AS keyword before outer BEGIN END block AS keyword required
5 User-defined delimiter at the end GO