Format T-SQL the way your team writes it, catch risky queries before they reach production, and type common SQL Server patterns in seconds. Works in VS Code, Cursor and VSCodium, next to Microsoft's SQL Server (mssql) extension — a good home for Azure Data Studio users now that ADS is retired.
Everything runs locally. Your SQL never leaves your machine.
Shift+Alt+F (Format Document) or Format Selection on any .sql file.
select c.Id, c.Name, count(*) as Orders from dbo.Customers c inner join dbo.Orders o on o.CustomerId = c.Id where c.IsActive = 1 and o.Total between 10 and 500 group by c.Id, c.Name
becomes
SELECT
c.Id,
c.Name,
COUNT(*) AS Orders
FROM dbo.Customers c
INNER JOIN dbo.Orders o ON o.CustomerId = c.Id
WHERE c.IsActive = 1
AND o.Total BETWEEN 10 AND 500
GROUP BY c.Id, c.Name
- Understands T-SQL structure: CTEs, subqueries,
MERGE, CASE, window functions, IF … ELSE, BEGIN … END, TRY/CATCH, procedures, functions, views, triggers, CREATE TABLE, GO batches and scripts without semicolons.
- Style options: keyword / function / data-type case, trailing or leading commas, indent size or tabs,
AND/OR position, join indentation, stacked or compact select lists, line length, blank lines.
- Safe by design: after formatting, T-SQL Tools re-reads its own output and compares it token by token with your code. If anything other than whitespace and keyword case would change, it leaves the code untouched and tells you.
- Comments, strings,
[bracketed] names and multi-line literals are kept exactly as written.
Linter with quick fixes
"Plan" says where the rule runs. The one-click quick fixes are part of Pro (and the trial); "Ignore on this line" is free for every rule.
| Rule |
Finds |
Quick fix |
Plan |
| TSQL001 |
SELECT * |
Expand to the column list when the table is defined in the script |
Free |
| TSQL002 |
UPDATE/DELETE without WHERE |
Insert a safe WHERE 1 = 0 placeholder |
Free |
| TSQL003 |
NOLOCK, READ UNCOMMITTED |
Remove the hint / use READ COMMITTED |
Free |
| TSQL004 |
= NULL, <> NULL |
IS NULL / IS NOT NULL |
Free |
| TSQL005 |
Missing schema prefix |
Add dbo. (configurable) |
Pro |
| TSQL006 |
Non-sargable predicates: YEAR(col) = …, ISNULL(col, …) = …, LEFT(col, n) = …, DATEADD(…, col) < …, col + 1 > …, LIKE '%…' |
Rewrite to an index-friendly form (date range, LIKE 'abc%', arithmetic moved to the other side…) |
Pro |
| TSQL007 |
Implicit conversions: VARCHAR column vs N'…' or NVARCHAR variable, string column vs number (types read from CREATE TABLE, table variables and DECLARE in the script) |
Drop the N, quote the number, or fix the variable's declared type |
Pro |
| TSQL008 |
@@IDENTITY |
SCOPE_IDENTITY() |
Pro |
| TSQL009 |
TOP without ORDER BY |
— |
Pro |
| TSQL010 |
TEXT, NTEXT, IMAGE |
VARCHAR(MAX), NVARCHAR(MAX), VARBINARY(MAX) |
Pro |
Every finding can be silenced from the light bulb (Ignore on this line) or with comments:
-- tsql-tools-disable-next-line TSQL001
SELECT * FROM dbo.Lookup;
SELECT * FROM dbo.Lookup; -- tsql-tools-disable-line
/* tsql-tools-disable TSQL005 */ -- whole file
Change severities or switch rules off in settings: "tsqlTools.lint.rules": { "TSQL001": "off", "TSQL002": "error" }.
Snippets
40 core snippets (free): sel, seltop, join, ljoin, capply, ins, inssel, upd, updjoin, del, merge, cte, cterec, rownum, rank, lag, sumover, topn, try, tran, errinfo, throw, ct, ci, addcol, fk, proc, tvf, view, dec, dectable, temp, ifex, while, case, cursor, pivot, findcol, findtext, rowcounts.
15 Pro snippets for production patterns: proc-template (XACT_STATE-aware TRY/CATCH), upsert-merge-output, dedupe-row-number, batch-delete, paging-offset, gaps-islands, running-total, dynamic-sql-safe, deadlock-retry, openjson-parse, string-agg-group, pivot-dynamic, temporal-as-of, index-usage, blocking-now.
Free and Pro
Free, forever: the formatter with all style options, 40 snippets, four lint rules (TSQL001–TSQL004) and "ignore" actions.
Pro adds all ten lint rules, one-click quick fixes, named formatting profiles, the team config file and the Pro snippet pack. Every install gets a 14-day Pro trial — no sign-up, no card.
Get Pro: Command Palette → T-SQL Tools: Get T-SQL Tools Pro. The checkout opens on blznworks.com (Paddle is the merchant of record, so taxes and invoices are handled). After payment the extension picks up the license by itself; or run T-SQL Tools: Enter Pro License Key with the key from the e-mail. One license covers 3 devices.
Team config (Pro)
Run T-SQL Tools: Create Team Config File to add .tsqltools.json to your repository. Everyone with Pro then formats and lints the same way:
{
"format": { "keywordCase": "upper", "commaPosition": "leading", "indentSize": 4 },
"lint": { "defaultSchema": "dbo", "rules": { "TSQL001": "off", "TSQL002": "error" } }
}
Team settings win over personal settings. The file is ignored in untrusted workspaces.
"tsqlTools.format.profiles": {
"compact": { "keywordCase": "lower", "selectListLayout": "fit" },
"review": { "commaPosition": "leading", "logicalOperatorPosition": "leading" }
},
"tsqlTools.format.activeProfile": "compact"
If you have more than one SQL formatter installed, pick T-SQL Tools once:
"[sql]": { "editor.defaultFormatter": "blznworks.tsql-tools" }
Privacy
- Formatting and linting run entirely on your machine. No SQL text is ever sent anywhere.
- License activation and a daily license check contact
blznworks.com with the license key and a random install id.
- If VS Code telemetry is enabled, the extension sends anonymous counters (install, daily active, Pro prompt shown) with the product name only. Turn VS Code telemetry off to stop them.
Privacy policy: https://blznworks.com/privacy · Support: info@blznworks.com
Known limits
- T-SQL Tools does not connect to a database. Rules that need types (TSQL007) and the
SELECT * expansion only see tables and variables declared in the same script.
- Very unusual syntax may be left unformatted (you will see a message); it is never changed incorrectly.