Convert SQL Server to MySQL

A free online converter that translates SQL Server queries into MySQL. Paste your SQL, press Translate, and Query Studio rewrites the syntax that differs between the two databases — instantly, with no login and nothing stored.

How hard this is depends almost entirely on the target MySQL version. On 8.0 it is a syntax exercise. On 5.7 there are no CTEs and no window functions, and a lot of ordinary T-SQL has no direct expression at all.

Open in the editor →All Query Studio tools

SQL ServerMySQL example

Here is a real SQL Server query and the MySQL output Query Studio produces:

SQL Server input
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;
MySQL output
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

What changes from SQL Server to MySQL

  • Identifier quoting is rewritten from bracketed [identifiers] to backtick `identifiers`.
  • Row limiting is converted from SQL Server's TOP n to MySQL's LIMIT n, including any OFFSET for pagination.
  • Null-handling functions such as ISNULL() are mapped to IFNULL().
  • Current-timestamp functions like GETDATE() become NOW() / CURRENT_TIMESTAMP.
  • The result is re-indented and keyword-cased in MySQL style so it's ready to paste and run.

SQL Server to MySQL data type mapping

Query Studio translates queries, not schemas. When you come to move the tables themselves, this is what changes between SQL Server and MySQL:

Data type equivalents from SQL Server to MySQL
SQL ServerMySQLWatch out for
INT IDENTITY(1,1)INT AUTO_INCREMENTDirect equivalent.
NVARCHAR(MAX)LONGTEXTDirect equivalent.
BITTINYINT(1)Direct equivalent.
DATETIME2DATETIME(6)Direct equivalent.
UNIQUEIDENTIFIERCHAR(36) or BINARY(16)Direct equivalent.
VARBINARY(MAX)LONGBLOBDirect equivalent.
TOP nLIMIT nDirect equivalent.
[bracketed identifiers]`backtick identifiers`Direct equivalent.

SQL Server to MySQL: 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.

Window functions need MySQL 8.0

T-SQL has had window functions since 2005 and they are everywhere in real queries. MySQL only gained them in 8.0 — on 5.7 a ROW_NUMBER() OVER (…) has to be rewritten with user variables or a self-join, which is unpleasant and slow. Check the target version first; it decides how hard this migration is.

CTEs and recursive CTEs need MySQL 8.0 too

WITH … AS is not available in MySQL 5.7 at all. Any T-SQL using a CTE for readability has to be inlined as a derived table, and anything recursive has no equivalent short of application code.

TOP without ORDER BY, translated, is still non-deterministic

SELECT TOP 10 with no ORDER BY returns whatever the engine finds first, and so does LIMIT 10. The translation is faithful; the query was always unreliable.

ISNULL takes two arguments, IFNULL takes two, COALESCE takes many

ISNULL(a, b) maps to IFNULL(a, b) — but note that SQL Server's ISNULL forces the result to the first argument's type, which can silently truncate. COALESCE works identically in both and is the safer target.

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 SQL ServerMySQL 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 SQL Server to MySQL

  1. Open the Query Studio editor and choose SQL Server as the “From” dialect.
  2. Choose MySQL as the “To” dialect.
  3. Paste your SQL Server query and press Translate — copy the MySQL result.

Try it with your own query

The editor is preloaded with SQL ServerMySQL. You can also explain, format, validate and analyze the result.

Convert SQL Server to MySQL 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.

SQL Server to MySQL FAQ

Is this SQL Server to MySQL 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 SQL Server to MySQL 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 SQL Server to MySQL?

The differences that most often cause problems on this pair: Window functions need MySQL 8.0; CTEs and recursive CTEs need MySQL 8.0 too; TOP without ORDER BY, translated, is still non-deterministic; ISNULL takes two arguments, IFNULL takes two, COALESCE takes many. Each is explained in full above, with before-and-after examples where seeing it is quicker than reading about it.

How do SQL Server data types map to MySQL?

The full mapping table is above and covers 8 types. The ones that are not a straight rename: . 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 SQL Server to MySQL 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 MySQL back to SQL Server?

Yes. Use the MySQL to SQL Server 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.

Other conversions

MySQL to SQL ServerMySQL to PostgreSQLPostgreSQL to MySQLSQL Server to PostgreSQLPostgreSQL to SQL ServerMySQL to Google BigQueryPostgreSQL to Snowflake