On-demand training: More Gems from the SQL Prompt Treasure Chest. Watch now.

How do I line up tables?

I'm not sure if this can be done, or if I'm just missing a setting, but I like to format a Select Statement with a Join to have the table names in alignment. E.g.:
FROM		Table1
	ON	Table1.ID = Table2.ID
WHERE		Table2.Column = 12345

I like the big white gap down the middle (it's not as big in SSMS) and I've got SQL Prompt to do this and it works great...until I don't have a group by clause. When I don't have a group by, the Select list, the "From" table name and the Where clause all move back a tab:
FROM	TransactionLine
INNER JOIN SalesOrderLine
	ON SalesOrderLine.TransactionLineID = TransactionLine.TransactionLineID
WHERE	SalesOrderLine.TransactionLineID = 12345

The reason that the group by clause makes the difference is because I have "Align items across clauses" enabled and the key word GROUP BY pushes it out to the right spot.

Is there anyway I can make it look the same as the top example if I don't have a group by clause?

Best Answer


Sign In or Register to comment.