How do I line up tables?
GregDodd
Posts: 12 Bronze 2
in SQL Prompt
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.:
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:
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?
SELECT * FROM Table1 INNER JOIN Table2 ON Table1.ID = Table2.ID WHERE Table2.Column = 12345 GROUP BY Table1.ID
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:
SELECT * 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?
Tagged:
Answers
I know that it could be just a workaround, but you can try to change the tab size.
CTO @ Engage IT Services s.r.l.
Database Administrator and Team Leader
Microsoft MVP - Data Platform
Staff member of getlatestversion.it community
personal website | blog
This is definitely not intended behaviour - I've reproduced the issue locally and hopefully we'll have a fix out soon
Thanks for your patience!
James
Redgate Software
Thanks for your post and for bringing this to our attention.
We have now reproduced the issue and a fix will available in the upcoming release of SQL Prompt.
I will post back in here when this has been released.
Best
Redgate Software