Skip to Content

Poor Man's T-SQL Formatter

I’m a bit OCD about my SQL code.

Frequently I’ll see something like

:::sql
select firstname, lastname, address1, address2, city, state, zip, homephone, cellphone, business-address1, business-address2, business-city, business-state, business-zip, business-phone, business-fax, etc.

You get the idea.

This drives me nuts.

I’d much rather see

:::sql
SELECT firstname
    ,lastname
    ,address1
    ,address2
    ,city
    ,STATE
    ,zip
    ,homephone
    ,cellphone
    ,business-address1
    ,business-address2
    ,business-city
    ,business-STATE
    ,business-zip
    ,business-phone
    ,business-fax
    ,etc.

Sometimes I’m in my SQL editor and have a code formatter available but sometimes I’m editing code on a wiki or a Word document for documentation..

Enter Poor Man’s T-SQL Formatter. This is a great plugin for SQL Server Management Studio but they also provide a stand alone website at http://poorsql.com/ which you can bookmark for easy access.

Drop in ugly query, click submit, get pretty query back.

Done.