Advertisement

T-SQL Formatter

Paste T-SQL for SQL Server and get clean formatting with uppercase keywords and indented subqueries. Handles TOP, bracketed identifiers, NVARCHAR types and SQL Server specific keywords.

T-SQL

Paste a T-SQL query below.

Advertisement

How the T-SQL formatter works

Bracketed identifiers like [Order Details], strings and comments are masked before formatting, so they are never altered. SQL Server keywords including TOP, IDENTITY, NVARCHAR, GETDATE, MERGE and TRY CATCH blocks are uppercased, with clauses broken onto lines and subqueries indented.

Why dialect formatters matter

Generic SQL formatters miss TOP, choke on brackets and do not know NVARCHAR. A dialect aware formatter keeps SQL Server idioms intact, which means less manual cleanup on stored procedures and reporting queries.

T-SQL Formatter FAQs

Are bracketed identifiers preserved?
Yes. Anything inside square brackets is masked before formatting, so [select] as a column name is never uppercased or split apart.
Does it handle SELECT TOP?
Yes. TOP is a recognized keyword, so SELECT TOP 10 keeps TOP on the SELECT line with the row count intact.
What about TRY CATCH blocks?
BEGIN TRY, END TRY, BEGIN CATCH and END CATCH are recognized keywords. The block contents are indented normally, but complex procedural logic should be reviewed after formatting.
Does it format MERGE statements?
Yes. MERGE, WHEN MATCHED and OUTPUT are in the keyword list, so merge statements get consistent casing with each clause on its own line.
Is my query sent to a server?
No. Formatting happens entirely in your browser, so proprietary queries and schema names never leave your device.
Advertisement