SQL Server (T-SQL) Formatter

Paste a T-SQL query and get consistently formatted SQL. Bracketed [identifiers], @parameters and SQL Server clauses such as TOP and OPTION are all handled.

SQL Server syntax it handles

A generic formatter mangles dialect-specific syntax or refuses it outright. These are the SQL Server constructs this formatter is tested against.

@Parameter

T-SQL parameters are detected and grouped by name.

[identifier]

Bracketed identifiers keep their brackets and internal spacing.

TOP (n)

Formatted as part of the SELECT clause rather than split off.

@@ROWCOUNT

System variables are not reported as parameters.

SQL Server formatter FAQ

Are @parameters detected?

Yes, and system variables such as @@ROWCOUNT are correctly excluded, so only real parameters appear in the Parameters panel. Fill each parameter once and every occurrence in the query updates together.

Can it format a query with several CTEs?

Yes. Every WHERE clause in the query is listed by the CTE it belongs to, so you can pick one and edit it as an AND/OR tree or a node graph while the rest of the query stays untouched.

Is my query sent to a server?

No. Everything runs in your browser, so schema names, table names and any embedded values never leave your machine.