Comments
7 comments
-
Which version of SSMS are you using?
What version of SQL Prompt are you using? This is in the format of X.x.x.xx and be found under SQL Prompt 5 > Help > About -
SSMS: 10.50.1600.1
SQL Prompt Pro: 5.1.4.11 -
Please can you try downloading this LayoutOptions.xml file, and then through SQL Prompt Options menu (navigate to Format >Styles) select this config file in the Style dropdown menu (need to select Import...).
ftp://support.red-gate.com/patches/SQL_ ... ptions.xml
Now try the 'Format SQL' again.
Please let me know how you get on. -
Hello chrisk5,
I get the same result. The followingSELECT P.NAME AS Parent, C.NAME AS Child FROM dbo.ListOfThings P --Parent JOIN dbo.ListOfThings C --Child ON P.NAME = C.Parent
still is formated to thisSELECT P.NAME AS Parent, C.NAME AS Child FROM dbo.ListOfThings P --Parent JOIN dbo.ListOfThings C --Child ON P.NAME = C.Parent
with the imported style you provided.
Edmund -
I think that you may have found a known issue, although it is a little odd that my config file didn't help.
Anyway could you try this. Go to the SQL Prompt options and go to Data statements (which is under Format) and ensure that 'Join condition' is not selected. Do you now see the proper results. -
Hi chrisk5,
Things format a little better with the recomendation you provided. The followingSELECT P.NAME AS Parent, C.NAME AS Child FROM dbo.ListOfThings P --Parent JOIN dbo.ListOfThings C --Child ON P.NAME = C.Parent
now formats toSELECT P.NAME AS Parent, C.NAME AS Child FROM dbo.ListOfThings P --Parent JOIN dbo.ListOfThings C --Child ON P.NAME = C.Parent
.
The commet stays on the same line but ON condition is indented. However, I can't use that option as I need the join condition on a new line in locations where there is no table alias comment and the join condition is currently on the same line.
I guess the good news is that this is a known issue. As I understand this thread there is no fix for this currently but it will be addressed in the next update of SQL Prompt. Correct?
Thanks,
Edmund -
Yes you are correct, this seems to be a known issue. I have updated the bug report SP-3571 with your scenario so that the developers can take a look. At the moment though i do not have any information on when this will be tackled.
Add comment
Please sign in to leave a comment.
I've recently installed SQL Prompt Pro and have noticed that Format SQL behaves oddly when table alias comments are present. For example, formats to, instead of,
The spacing is better seen once pasted in SSMS (May you move to a fixed width font for the Code format on the forum). As you can see the ON condition gets indented and the comment placed on a new line for the second join. Instead the ON should stay inline with the JOIN (as it does without the comment) and the comment should stay on the same line as the table.
Can this be fixed?
Thanks,
Edmund
Below is the format style being used.