How can we help you today? How can we help you today?

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.:
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?
Greg
0

Comments

6 comments

  • AlessandroAlpi
    Hi GregDodd,
    I know that it could be just a workaround, but you can try to change the tab size.
    AlessandroAlpi
    0
  • GregDodd
    Thanks @AlessandroAlpi. I thought I had tried that, but just tried it again and it works. It's a bit of an ugly solution though. Before using SQL Prompt I'd just use 2 tabs instead of 1, it would be nice if I could specify that somewhere.
    GregDodd
    0
  • James R
    Hey @GregDodd , thanks for the information.

    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
    James R
    0
  • GregDodd
    Hi @James R - just wondering how you were going with this? Any updates on when a fix might be out?
    GregDodd
    0
  • GregDodd
    Looks like it's fixed in 8.2.1.2603. Thanks!
    GregDodd
    0
  • RichardL
    Hi Greg.

    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
    RichardL
    0

Add comment

Please sign in to leave a comment.