SQLFormatter
FormatterConvertPricingDocsGet Pro
SQL Converter · T-SQLPostgreSQL

Convert T-SQL SQL to PostgreSQL

SQL Server to PostgreSQL swaps TOP for LIMIT, [brackets] for "double quotes", ISNULL for COALESCE and GETDATE() for now(). A mechanical formatter only re-indents — it won’t rewrite dialect-specific syntax. The AI converter in the app translates the query and the table below shows exactly what changes.

T-SQL — source
T-SQL
SELECT TOP 20 OrderId,
       ISNULL(Total, 0) AS Total
FROM dbo.Orders
WHERE CreatedAt > GETDATE() - 7
ORDER BY CreatedAt DESC;
PostgreSQL — converted
PostgreSQL
SELECT "OrderId",
       COALESCE("Total", 0) AS "Total"
FROM orders
WHERE created_at > now() - INTERVAL '7 days'
ORDER BY created_at DESC
LIMIT 20;
Convert your own query

What changes from T-SQL to PostgreSQL

T-SQLPostgreSQLWhy
TOP 20LIMIT 20TOP is T-SQL syntax; Postgres uses a trailing LIMIT.
[Identifier]"identifier"Bracket quoting becomes standard double-quote quoting.
ISNULL(x, 0)COALESCE(x, 0)ISNULL is T-SQL-only; COALESCE is portable.
GETDATE()now()Current-timestamp function differs by dialect.

Other SQL conversions

OraclePostgreSQLMySQLPostgreSQLT-SQLMySQLT-SQLSnowflakeRedshiftPostgreSQLAll conversions →