Home > Documentation > MS SQL to MySQL

Microsoft SQL to MySQL Types Mapping

[SQL Server to MySQL Converter]  [About Migration]  [Converting Queries]  [Stored Procedures]

Both SQL Server and MySQL have similar set of data types. Some of them are compatible with each other, while the rest are not. When designing the schema of custom (non-standard) types mapping, it is necessary to remember the following compatibility matrix for popular data types of Microsoft SQL and MySQL. In tables below all valid type mappings are marked green (with restriction on data if any), every prohibited or dangerous type mapping is marked orange.

Text / Binary

 CHAR   VARCHAR   TEXT   NCHAR   NVARCHAR   NTEXT   BINARY   VARBINARY   IMAGE 
CHAR dest. length >= source length dest. length >= source length Possible truncation of text dest. length >= source length dest. length >= source length Possible truncation of text
VARCHAR dest. length >= source length dest. length >= source length Possible truncation of text dest. length >= source length dest. length >= source length Possible truncation of text
BINARY dest. length >= source length dest. length >= source length Possible truncation of data
VARBINARY dest. length >= source length dest. length >= source length Possible truncation of data
TINYBLOB Source length <= 255 Source length <= 255 Possible truncation of data
TINYTEXT Possible truncation of data Possible truncation of data
BLOB Possible truncation of data
TEXT Possible truncation of data Possible truncation of data
MEDIUMBLOB Possible truncation of data
MEDIUMTEXT Possible truncation of data Possible truncation of data
LONGBLOB
LONGTEXT

Numeric

 BIT   TINYINT   SMALLINT   INT   BIGINT   DECIMAL / 
NUMERIC
 MONEY   SMALLMONEY   FLOAT   REAL 
BOOLEAN
TINYINT
(-128 ... 127)
If source is out of range -128...127 use UNSIGNED Possible truncation of data Possible truncation of data Possible truncation of data Possible truncation of data
SMALLINT Possible truncation of data Possible truncation of data Possible truncation of data
INTEGER Possible truncation of data Possible truncation of data Possible truncation of data
BIGINT Possible truncation of data Possible truncation of data
DECIMAL Precision and scale should be the same Possible truncation of data Possible truncation of data
FLOAT Possible loss of precision Possible loss of precision Possible loss of precision Possible truncation of data
DOUBLE Possible loss of precision Possible loss of precision Possible loss of precision

Date / time

 DATE   DATETIME   DATETIME2   TIME   DATETIMEOFFSET   SMALLDATETIME 
DATE Possible truncation of data Possible truncation of data Possible truncation of data Possible truncation of data
TIME
DATETIME
TIMESTAMP