// бесплатный инструмент

SQL syntax converter

Paste a query in one dialect and get it back in another: T-SQL, PostgreSQL, MySQL/MariaDB, SQLite or Oracle, in any direction. Quoting, row limits, string functions and date arithmetic are rewritten for the target engine. Anything with no translation, or that behaves differently at the edges, gets a review note with its line number. It runs in your browser, so your SQL never leaves your device.

Ctrl + Enter

Converts as you type. Your draft stays in this browser only.

Converted SQL (PostgreSQL)
SELECT
       c."CustomerName",
       COALESCE(c."Region", 'Unknown') || ' / ' || c."Country" AS Label
FROM "dbo"."Customers" AS c
WHERE LENGTH(c."Phone") > 0
  AND c."Created" >= CURRENT_TIMESTAMP + INTERVAL '-30 days'
ORDER BY c."Created" DESC LIMIT 10;

Review notes

    The converter works on tokens, not on a full parse of your query. It rewrites what it is sure of and lists the rest here. Select a line number to jump to it in your SQL, and check every noted line before you run the result.

    The syntax differences it converts

    The native spelling of common constructs on each engine. The converter does not always write the spelling shown: for a null fallback it writes COALESCE, which all five engines accept, unless the target has the source function under the same name.

    Construct T-SQL PostgreSQL MySQL / MariaDB SQLite Oracle
    Identifier quoting [Name] "Name" `Name` "Name" "Name"
    String concatenation a + b (|| from SQL Server 2025) a || b CONCAT(a, b) a || b a || b
    First rows SELECT TOP 10 LIMIT 10 LIMIT 10 LIMIT 10 FETCH FIRST 10 ROWS ONLY
    Skip rows OFFSET 10 ROWS FETCH NEXT 5 ROWS ONLY LIMIT 5 OFFSET 10 LIMIT 5 OFFSET 10 LIMIT 5 OFFSET 10 OFFSET 10 ROWS FETCH NEXT 5 ROWS ONLY
    Current time (local) GETDATE() CURRENT_TIMESTAMP NOW() datetime('now', 'localtime') SYSDATE
    Add time DATEADD(day, 3, d) d + INTERVAL '3 days' DATE_ADD(d, INTERVAL 3 DAY) datetime(d, '+3 days') d + 3
    Days between DATEDIFF(day, a, b) CAST(b AS DATE) - CAST(a AS DATE) DATEDIFF(b, a) julianday(date(b)) - julianday(date(a)) TRUNC(b) - TRUNC(a)
    String length LEN(s) (ignores trailing spaces) LENGTH(s) CHAR_LENGTH(s) (LENGTH counts bytes) LENGTH(s) LENGTH(s)
    Find a substring CHARINDEX(sub, s) POSITION(sub IN s) LOCATE(sub, s) INSTR(s, sub) INSTR(s, sub)
    Null fallback ISNULL(a, b) COALESCE(a, b) IFNULL(a, b) IFNULL(a, b) NVL(a, b)
    Case-insensitive match LIKE (default CI collation) ILIKE LIKE (default CI collation) LIKE (ASCII only) UPPER(a) LIKE UPPER(b)
    Булев BIT BOOLEAN BOOLEAN (alias of TINYINT(1)) INTEGER 0/1 BOOLEAN (23ai), NUMBER(1) до
    Auto-increment key IDENTITY(1, 1) GENERATED ALWAYS AS IDENTITY AUTO_INCREMENT INTEGER PRIMARY KEY AUTOINCREMENT GENERATED ALWAYS AS IDENTITY

    Примеры

    Three queries and what the converter makes of them. The first is the one the tool starts with. Open any of them in the converter to see its review notes.

    T-SQL to PostgreSQL: a top-10 report query

    Before - T-SQL (SQL Server)
    SELECT TOP (10)
           c.[CustomerName],
           ISNULL(c.[Region], 'Unknown') + ' / ' + c.[Country] AS Label
    FROM [dbo].[Customers] AS c
    WHERE LEN(c.[Phone]) > 0
      AND c.[Created] >= DATEADD(day, -30, GETDATE())
    ORDER BY c.[Created] DESC;
    After - PostgreSQL
    SELECT
           c."CustomerName",
           COALESCE(c."Region", 'Unknown') || ' / ' || c."Country" AS Label
    FROM "dbo"."Customers" AS c
    WHERE LENGTH(c."Phone") > 0
      AND c."Created" >= CURRENT_TIMESTAMP + INTERVAL '-30 days'
    ORDER BY c."Created" DESC LIMIT 10;

    MySQL to T-SQL: paging with LIMIT and OFFSET

    Before - MySQL / MariaDB
    SELECT o.id, CONCAT(o.first_name, ' ', o.last_name) AS who
    FROM orders AS o
    WHERE CHAR_LENGTH(o.note) > 10
    ORDER BY o.created_at DESC
    LIMIT 25 OFFSET 50;
    After - T-SQL (SQL Server)
    SELECT o.id, CONCAT(o.first_name, ' ', o.last_name) AS who
    FROM orders AS o
    WHERE LEN(o.note) > 10
    ORDER BY o.created_at DESC
    OFFSET 50 ROWS FETCH NEXT 25 ROWS ONLY;

    PostgreSQL to MySQL: intervals and case-insensitive search

    Before - PostgreSQL
    SELECT id, COALESCE(nickname, login) AS handle, LENGTH(bio) AS bio_len
    FROM users
    WHERE login ILIKE '%dev%'
      AND created_at + INTERVAL '7 days' > now()
    LIMIT 100;
    After - MySQL / MariaDB
    SELECT id, COALESCE(nickname, login) AS handle, CHAR_LENGTH(bio) AS bio_len
    FROM users
    WHERE login LIKE '%dev%'
      AND DATE_ADD(created_at, INTERVAL 7 day) > now()
    LIMIT 100;

    How the converter works

    • It reads the query the way the source engine does. The query is split into tokens with the source engine's rules: strings, comments, quoted identifiers and numbers stay whole, so a rewrite never touches the inside of a literal. MySQL input is read with MySQL rules ("..." is a string, || is OR, \' is an escaped quote).
    • What it rewrites. Identifier quoting, concatenation, TOP / LIMIT / OFFSET / FETCH (including subqueries and TOP n PERCENT on Oracle), current-date functions, DATEADD / DATE_ADD / INTERVAL arithmetic, DATEDIFF in days, YEAR / MONTH / DAY / DATEPART / EXTRACT, LEFT and RIGHT, LEN / CHAR_LENGTH / DATALENGTH, CHARINDEX / POSITION / INSTR, ISNULL / IFNULL / NVL, IIF and IF to CASE, CONVERT to CAST, STRING_AGG / GROUP_CONCAT / LISTAGG, aggregate FILTER clauses, CROSS / OUTER APPLY and LATERAL joins, MINUS / EXCEPT, WITH RECURSIVE, ILIKE, TRUE / FALSE on T-SQL, column types in CREATE TABLE and CAST, IDENTITY / AUTO_INCREMENT / SERIAL with seed and step, T-SQL #temp tables and GO lines, and PostgreSQL $$ and Oracle q'[...]' strings.
    • What it flags instead. About fifty engine-specific functions (DATE_FORMAT, DECODE, DATE_TRUNC, TO_CHAR, STRFTIME and more) are left as written with the usual replacement named. So are Oracle ROWNUM and CONNECT BY, MERGE and the upsert forms (ON CONFLICT, ON DUPLICATE KEY UPDATE), UPDATE and DELETE with a join, T-SQL variables, PIVOT, the T-SQL OUTPUT clause and RETURNING.
    • It stays in your browser. The conversion runs in your tab. Nothing is uploaded, logged or stored on a server. Your draft is kept in this browser's local storage so it survives a reload.

    SQL converter FAQ

    Is this SQL converter free?

    Yes. There is no sign-up and no usage limit.

    Отправляется ли мой SQL на сервер?

    No. The conversion runs in JavaScript inside your browser tab. The page sends no request containing your SQL, and nothing is logged or stored.

    Which dialects can I convert between?

    T-SQL (SQL Server and Azure SQL), PostgreSQL, MySQL and MariaDB, SQLite and Oracle, in both directions for every pair. Pick the source and the target and the matching rules apply.

    Why does the converter add review notes?

    Some constructs have no exact equivalent, and some rewrites change behavior at the edges. The converter works on tokens and never builds a full parse tree. When it rewrites something with a known difference (T-SQL LEN ignores trailing spaces, Oracle ADD_MONTHS keeps month-end dates at the month end) it says so, and when it cannot rewrite something (DATE_FORMAT, DECODE, Oracle ROWNUM) it leaves the SQL as written and names the usual replacement.

    Will every query convert perfectly?

    No. Some differences cannot be fixed at the token level: a + that might add numbers or join strings, a comparison like flag = 1 against a column that is BOOLEAN on PostgreSQL, a quoted mixed-case name that only matches if the table was created with that exact case. The converter never sees your column types, so the BOOLEAN comparison gets no note; the ambiguous + and the quoted name do. Check the noted lines, then run the result against a test database.

    What happens to my identifiers and quoting?

    Quoting is rewritten: [brackets] and `backticks` become "double quotes" for PostgreSQL, SQLite and Oracle, and the other way round. Quoted names are case-sensitive in PostgreSQL and Oracle, so the converter warns when a quoted name has a case the engine would not fold to. T-SQL #temp tables are renamed to tmp_ names with a note, because the other engines declare temporary tables with CREATE TEMPORARY TABLE.

    Does it convert CREATE TABLE statements?

    Partly. Column types inside CREATE TABLE and CAST are mapped (BIT to BOOLEAN, NVARCHAR(MAX) to TEXT, MONEY to NUMERIC(19, 4)), and auto-increment columns are rewritten with their seed and step: IDENTITY(100, 5) becomes GENERATED ALWAYS AS IDENTITY (START WITH 100 INCREMENT BY 5) on PostgreSQL and Oracle. For whole schemas with constraints and indexes, use the migration script generator, which handles more of the DDL.

    How is this different from the SQL formatter?

    The formatter keeps your dialect and changes only layout: line breaks, indentation and keyword casing. The converter changes the SQL itself (function names, quoting, row limits, date arithmetic) so the query runs on a different engine.

    // one query, every engine

    Switching between databases every day?

    SQLly runs T-SQL, PostgreSQL, MySQL, SQLite, Oracle and more side by side in one workbench, and its IntelliSense knows which dialect each tab is in.