Convert MySQL to SQL Server
A free online converter that translates MySQL queries into SQL Server. Paste your SQL, press Translate, and Query Studio rewrites the syntax that differs between the two databases — instantly, with no login and nothing stored.
Two engines with very different syntax and surprisingly compatible semantics. Row limiting and identifier quoting change on almost every query; the default case-insensitive collation carries across, which removes the usual biggest source of behaviour drift.
MySQL → SQL Server example
Here is a real MySQL query and the SQL Server output Query Studio produces:
SELECT u.id, u.name, COUNT(o.id) AS orders
FROM users u
LEFT JOIN orders o ON o.user_id = u.id
WHERE u.created_at > '2024-01-01' AND u.active = 1
GROUP BY u.id, u.name
HAVING COUNT(o.id) > 3
ORDER BY orders DESC
LIMIT 10;SELECT
TOP 10 u.id,
u.name,
COUNT(o.id) AS orders
FROM
users u
LEFT JOIN orders o ON o.user_id = u.id
WHERE
u.created_at > '2024-01-01'
AND u.active = 1
GROUP BY
u.id,
u.name
HAVING
COUNT(o.id) > 3
ORDER BY
orders DESC;What changes from MySQL to SQL Server
- Identifier quoting is rewritten from backtick `identifiers` to bracketed [identifiers].
- Row limiting is converted from MySQL's LIMIT n to SQL Server's TOP n, including any OFFSET for pagination.
- Null-handling functions such as IFNULL() are mapped to ISNULL().
- Current-timestamp functions like NOW() / CURRENT_TIMESTAMP become GETDATE().
- The result is re-indented and keyword-cased in SQL Server style so it's ready to paste and run.
MySQL to SQL Server data type mapping
Query Studio translates queries, not schemas. When you come to move the tables themselves, this is what changes between MySQL and SQL Server:
| MySQL | SQL Server | Watch out for |
|---|---|---|
| INT AUTO_INCREMENT | INT IDENTITY(1,1) | Direct equivalent. |
| TINYINT(1) | BIT | Direct equivalent. |
| DATETIME | DATETIME2 | DATETIME2 has better precision and range; plain DATETIME exists in both and means different things. |
| TEXT / LONGTEXT | NVARCHAR(MAX) | Direct equivalent. |
| BLOB | VARBINARY(MAX) | Direct equivalent. |
| ENUM('a','b') | VARCHAR(n) + CHECK constraint | SQL Server has no ENUM type. |
| `backtick identifiers` | [bracketed identifiers] | Direct equivalent. |
| LIMIT n | TOP n | Direct equivalent. |
| IFNULL() | ISNULL() | COALESCE works in both and is the portable choice. |
MySQL to SQL Server: what actually catches people out
Syntax is the part a translator can fix. These are the differences that survive a clean conversion and show up later as wrong results rather than as errors.
LIMIT becomes TOP, and pagination becomes OFFSET/FETCH
TOP n handles the simple case. The moment there is an OFFSET, T-SQL needs the OFFSET … FETCH NEXT form, which requires an ORDER BY clause. A MySQL query paginating without an ORDER BY has to acquire one.
SELECT * FROM users LIMIT 10 OFFSET 20;SELECT * FROM users ORDER BY id
OFFSET 20 ROWS FETCH NEXT 10 ROWS ONLY;Case-insensitive comparison arrives by default
MySQL's default collation compares case-insensitively, and so does SQL Server's — this is one of the rare pairs where that behaviour carries over. Do check the target database's collation, because a case-sensitive one (_CS_) changes the meaning of every equality on text.
GROUP_CONCAT becomes STRING_AGG
The syntax differs and so does the ordering clause: MySQL puts ORDER BY inside the function, SQL Server uses WITHIN GROUP. MySQL also truncates silently at group_concat_max_len, which defaults to 1024 bytes — a long-standing source of quietly wrong results that the migration is a good moment to notice.
SELECT GROUP_CONCAT(name ORDER BY name SEPARATOR ', ')
FROM users;SELECT STRING_AGG(name, ', ')
WITHIN GROUP (ORDER BY name) FROM users;No ENUM, and no ON UPDATE CURRENT_TIMESTAMP
Both are MySQL conveniences with no T-SQL equivalent. ENUM becomes VARCHAR with a CHECK constraint; the auto-updating timestamp becomes an AFTER UPDATE trigger.
What this converter will not do
Query Studio translates SQL syntax. Being honest about the boundary is more useful than claiming there isn’t one — and on MySQL → SQL Server specifically, these are the three that matter most:
Stored procedures, functions and triggers
Procedural code — PL/pgSQL, T-SQL procedures, MySQL routines — is a different language in every engine, with different control flow, error handling, variable declaration and transaction semantics. Query Studio translates queries, not programs. These have to be ported by hand.
Anything that depends on data rather than syntax
Whether a value fits the target type, whether a date is real, whether a text column's contents are valid UTF-8 — none of that is visible in the query. A translation can be syntactically perfect and still fail on the first row of the import.
Vendor-specific extensions
PostGIS geometry, MySQL spatial functions, SQL Server's FOR XML and hierarchyid, BigQuery's nested/repeated model, Snowflake's time travel. Where there is no equivalent concept, there is no translation — only a redesign.
The full list of what a syntax translator cannot do is on the Query Studio page.
How to convert MySQL to SQL Server
- Open the Query Studio editor and choose MySQL as the “From” dialect.
- Choose SQL Server as the “To” dialect.
- Paste your MySQL query and press Translate — copy the SQL Server result.
Try it with your own query
The editor is preloaded with MySQL → SQL Server. You can also explain, format, validate and analyze the result.
Convert MySQL to SQL Server now →Working with the data rather than the schema? Open a large CSV, JSON or Parquet file and query it with SQL — no upload, no row limit, and files far past what Excel will open.
MySQL to SQL Server FAQ
Is this MySQL to SQL Server converter free?
Yes — it's completely free with no account, no sign-up and no usage limits. Your query is processed to return the result and never stored.
Is the MySQL to SQL Server conversion accurate?
Query Studio rewrites syntax deterministically using real SQL parsers, so it gives the same result every time — there is no AI involved and no variation between runs. It handles the differences listed above automatically. What it cannot do is anything semantic: stored procedures, triggers, vendor extensions and performance characteristics all need a human. Review complex, vendor-specific queries before running them in production.
What breaks when migrating from MySQL to SQL Server?
The differences that most often cause problems on this pair: LIMIT becomes TOP, and pagination becomes OFFSET/FETCH; Case-insensitive comparison arrives by default; GROUP_CONCAT becomes STRING_AGG; No ENUM, and no ON UPDATE CURRENT_TIMESTAMP. Each is explained in full above, with before-and-after examples where seeing it is quicker than reading about it.
How do MySQL data types map to SQL Server?
The full mapping table is above and covers 9 types. The ones that are not a straight rename: DATETIME → DATETIME2, ENUM('a','b') → VARCHAR(n) + CHECK constraint, IFNULL() → ISNULL(). Note that Query Studio translates queries rather than schemas — the table is there to tell you what your CREATE TABLE statements need, not to rewrite them for you.
Does this MySQL to SQL Server converter use AI?
No. Every result is computed by real SQL parsers and rule engines, which is what makes it free, instant, unlimited and identical on every run. Nothing is sent to a model, so there are no rate limits, no per-request cost to pass on, and no possibility of a confidently wrong answer that looks plausible.
Can I convert SQL Server back to MySQL?
Yes. Use the SQL Server to MySQL converter, or press the Swap (⇄) button inside the editor to flip the direction instantly. Note that a round trip is not guaranteed to return your original text — both directions normalise formatting, and where one dialect has no equivalent for a feature the information is genuinely lost rather than recoverable.