WHERE-clause alignments
GHauan
Posts: 13 New member
in SQL Prompt
Hi.
Is there a way to have SQL Prompt align each element after WHERE on the same column as WHERE? Like this:
SELECT *
FROM dbo.Anlegg
WHERE AnleggsId = 1
AND StartDate <= getdate()
AND StopDate IS NULL;
The way it is now, I only get it formatted with the AND part aligned with the Anleggsid in WHERE-line.
(I tried to show how it was in this post, but the indentation was removed when posting.)
Is there an option setting to fix this?
Is there a way to have SQL Prompt align each element after WHERE on the same column as WHERE? Like this:
SELECT *
FROM dbo.Anlegg
WHERE AnleggsId = 1
AND StartDate <= getdate()
AND StopDate IS NULL;
The way it is now, I only get it formatted with the AND part aligned with the Anleggsid in WHERE-line.
(I tried to show how it was in this post, but the indentation was removed when posting.)
Is there an option setting to fix this?
Tagged:
Comments
Thanks for the suggestion. You can insert code tags on here to keep your text formatted.
Could I confirm you want to style your code like this? Are you using the new formatting options (enabled in experimental features)?
Best wishes,
Michael Clark
Technical Lead, SQL Prompt
Technical Lead, SQL Monitor
The way I want it to be, is the way it is in my original post. Meaning that the AND start on same column as the WHERE:
I have not tried the experimental features.
The way it is formatted today is like this (and this is not how I want it):
We support the style you want as default with our new formatting styles.
You can turn these on by selecting "SQL Prompt > Options... > Labs > Experimental Features > Use new formatting styles"
Please let us know if you have any trouble
Thanks,
Michael
Technical Lead, SQL Monitor
Example
SELECT *
FROM table AS t
WHERE t.col1=1
AND t.col2=2;
I had it before, but had to rebuild my machine and lost my old style.