Migrate MySQL to SQL Server
Certified — live-tested pathThe converter maps 20 MySQL column types to SQL Server. 4 of them change kind on the way (YEAR becomes SMALLINT, JSON becomes NVARCHAR(MAX), ENUM('a','b') becomes NVARCHAR(255), and more); the table below lists every one. DBShifts converts the schema, copies the rows in parallel batches and checks the result with row counts and checksums.
Free tier · no credit card
Not ready to connect a database? Paste your CREATE TABLE statements and see the SQL Server schema now
MySQL vs SQL Server
MySQL
the world's most deployed open-source relational database.
SQL Server
Microsoft's enterprise relational database.
MySQL to SQL Server data type mapping
Pulled directly from DBShifts's own conversion rules — not a general reference table, this is what actually runs.
| MySQL | SQL Server |
|---|---|
| INT | INT |
| BIGINT | BIGINT |
| SMALLINT | SMALLINT |
| TINYINT(1) | BIT |
| DECIMAL(10,2) | DECIMAL(10,2) |
| FLOAT | FLOAT |
| DOUBLE | FLOAT(53) |
| VARCHAR(255) | NVARCHAR(255) |
| TEXT | NVARCHAR(MAX) |
| LONGTEXT | NVARCHAR(MAX) |
| CHAR(10) | NCHAR(10) |
| DATE | DATE |
| DATETIME | DATETIME2 |
| TIMESTAMP | DATETIMEOFFSET |
| TIME | TIME |
| YEAR | SMALLINT |
| BLOB | VARBINARY(MAX) |
| JSON | NVARCHAR(MAX) |
| ENUM('a','b') | NVARCHAR(255) |
| SET('a','b') | NVARCHAR(MAX) |
Example: MySQL to SQL Server schema conversion
MySQL
CREATE TABLE orders (
id INT AUTO_INCREMENT PRIMARY KEY,
customer_id INT NOT NULL,
status ENUM('new','paid','shipped') NOT NULL DEFAULT 'new',
total DECIMAL(10,2) NOT NULL,
is_gift TINYINT(1) NOT NULL DEFAULT 0,
notes TEXT,
metadata JSON,
placed_at DATETIME NOT NULL
);SQL Server
IF OBJECT_ID(N'orders', 'U') IS NULL
CREATE TABLE [orders] (
[id] INT IDENTITY(1,1) NOT NULL,
[customer_id] INT NOT NULL,
[status] NVARCHAR(255) NOT NULL DEFAULT N'new',
[total] DECIMAL(10,2) NOT NULL,
[is_gift] BIT NOT NULL DEFAULT 0,
[notes] NVARCHAR(MAX),
[metadata] NVARCHAR(MAX),
[placed_at] DATETIME2 NOT NULL,
CONSTRAINT [PK_orders] PRIMARY KEY ([id])
);BIT cannot hold what TINYINT was holding
The type table on this page maps TINYINT(1) to BIT, which is right for the boolean case and wrong for everything else. SQL Server's BIT stores 0, 1 or NULL — nothing else. A MySQL column declared TINYINT(1) can legally hold any value from -128 to 127, and applications do use it that way for small counters and status codes. Anything outside 0/1 fails to convert, and it fails per row rather than up front.
The only thing distinguishing a boolean from a small integer in MySQL is the display width, which is advisory. Before converting, run SELECT DISTINCT on every TINYINT(1) column and look at the actual values. If a column holds 2, it is not a boolean regardless of how it was declared, and it belongs in a TINYINT on the SQL Server side.
utf8mb4 into VARCHAR loses characters silently
MySQL's utf8mb4 stores the full Unicode range, including emoji and the CJK extension planes. SQL Server's VARCHAR is single-byte under a legacy collation, so a direct VARCHAR target replaces anything outside the code page with a question mark. There is no error. The load succeeds, the row counts match, and the data is damaged.
The fix is NVARCHAR, which is UTF-16 and covers the same range. On SQL Server 2019 and later a UTF-8 collation on VARCHAR also works and costs less space for mostly-ASCII data. What does not work is assuming the default collation will cope, which is the usual path to discovering this months later in a customer's name.
This is worth checking against real data rather than the schema, because the damage is invisible in a row count and in a checksum taken after conversion. Compare against the source.
MySQL allows many NULLs in a unique index; SQL Server allows one
This is the difference that breaks the load rather than the data. A MySQL unique index treats NULLs as distinct, so a nullable unique column can hold any number of NULL rows. A SQL Server UNIQUE constraint treats NULLs as equal, so the second NULL is a duplicate key violation.
A table that was perfectly valid in MySQL therefore cannot be loaded into a straight translation of its own schema. The usual answer is a filtered unique index (WHERE column IS NOT NULL), which reproduces the MySQL behaviour exactly. Deciding that after the load has already failed halfway through is considerably less pleasant than deciding it before.
MySQL → SQL Server conversion notes
Engine-specific rules baked into the conversion and transfer pipeline — verified by live certification of this exact pair.
- TINYINT(1) is treated as a boolean; plain TINYINT stays numeric — converting both blindly corrupts ratings and counters.
- UNSIGNED integers are widened on targets without unsigned types, so values above the signed range survive.
- ENUM and SET columns are converted with their value lists preserved (native enums, CHECK constraints, or arrays depending on the target).
- TIME columns are durations (-838h..838h) at the driver level — DBShifts converts them per target instead of failing the batch.
- Zero dates (0000-00-00) are normalized deterministically and reported, never silently dropped.
- IDENTITY_INSERT is managed per table so explicit IDs from the source load correctly, then counters are reseeded with DBCC CHECKIDENT.
- Binary columns always carry an explicit length — bare VARBINARY (which means 1 byte) never reaches the target.
- TRUNCATE falls back to DELETE on FK-referenced tables automatically.
Frequently asked questions
Is MySQL to SQL Server migration production-ready in DBShifts?
Yes. MySQL to SQL Server is a certified pair: it passes the live certification suite on real MySQL and SQL Server servers, which checks schema fidelity, row counts, type-aware checksums and paging across batches.
What happens to MySQL types that SQL Server doesn't have?
Each gets the nearest SQL Server type the converter treats as safe: YEAR becomes SMALLINT, JSON becomes NVARCHAR(MAX), ENUM('a','b') becomes NVARCHAR(255), SET('a','b') becomes NVARCHAR(MAX). Every such decision is in the migration plan before anything runs, and any mapping can be overridden per column.
Can I keep MySQL and SQL Server in sync after the initial migration?
Yes, until you cut over. DBShifts reads the row-based binary log (binlog_format = ROW). With zero-downtime mode on, the log position is captured before the first row is copied, so writes made during the copy are replayed afterwards.
Which MySQL data types need a second look when moving to SQL Server?
The table above carries a note on 9 of them: TINYINT(1) (BIT), FLOAT (FLOAT), DOUBLE (FLOAT(53)), TIMESTAMP (DATETIMEOFFSET) and more. Analysis flags the same columns on your own schema before any data moves.
Go deeper
How We Live-Certified All 49 Migration Paths
The certification harness behind this page's claims.
The Hidden Data-Loss Traps in Cross-Engine Migration
Five silent bugs the certification harness caught, from clipped TINYINTs to rounded NUMERICs.
Reference
- Getting started
- Running a migration, step by step
- Full type-mapping reference
- All supported pairs and their tiers
- Known limitations
- Understanding data-loss warnings
- Going live with cutover
- Watching for drift after cutover
- Run this migration from CI/CD
- Rewrite MySQL queries for SQL Server
- Convert your MySQL CREATE TABLE statements to SQL Server
Compared with other tools
Errors you may hit
Ready to move MySQL to SQL Server?
Set up in under two minutes. Validation and rollback included.
Start Free Migration