Please look at parenthesis formatting for WHERE EXISTS

Nikos226Nikos226 Posts: 14 New member
Hello,

I asked this question a few months ago and received no response, so I'm attempting to bring attention to this issue again.

I often use WHERE EXISTS in my SQL, but I'm unable to control how parenthesis format with my preferred parenthesis style Expanded, to statement. I also set Operators Alignment to first list item and Place AND / OR keyword before the condition is checked.

Formatting is tolerable when using two other parenthesis styles Expanded, Simple or Compact, Simple (see samples below), but what I'd really like is to be able to have it with my preferred style.

Is there a way this functionality can be reviewed - or is this something I just need to deal with? I included my format style as well. Thank you.

Here are some samples:

Expanded, Simple
Indent parenthesis contents = checked


Compact, Simple
Indent parenthesis contents = not checked


Expanded, to statement (preferred style - but has parenthesis formatting issue)

Indent parenthesis contents = checked


WISHLIST TO CORRECT
Expanded, to statement (preferred style - no parenthesis formatting issue)
Indent parenthesis contents = checked

Tagged:

Best Answer

  • Nikos226Nikos226 Posts: 14 New member
    edited December 13, 2019 11:50AM Answer ✓
    I need to point out that a FREE addon (Poor Mans T-SQL Formatter) can do this type of formatting without issue at all.

    Thank you.

Answers

  • Alex BAlex B Posts: 1,157 Diamond 4
    Hi @Nikos226,

    What version of SQL Prompt are you using?  I have an option for "Expanded, indented" which formats my sample query exactly as you are looking for:


    You didn't mention this in your other examples, but it looks just like your last "wishlist" example.

    If you do have this option, is there a reason you do not want to use it?

    Kind regards,
    Alex
    Product Support Engineer | Redgate Software

    Have you visited our Help Center?
  • Nikos226Nikos226 Posts: 14 New member
    edited November 8, 2019 3:01PM
    My example is clearly showing broken formatting with EXISTS. Instead of having parenthesis directly under the operator EXISTS, they for formatted to similar to JOIN.

    Sample with this without exists

    AND
    (
         1=1
    )

    You'll notice parenthesis are aligned directly under the AND operator.

    However parenthesis are not aligning directly under the EXISTS operator.

    Yes - your example shows something similar, but this doesn't address the root issue and all parenthesis styles will use this formatting, which is something I'm looking to avoid.

     
  • Jessica RJessica R Posts: 1,319 Rose Gold 4
    Hi @Nikos226 ,

    Thank you for clarifying that! I'm afraid though that aligning the EXISTS directly under the parentheses isn't possible at the moment. Can you please add a feature request for this option to our uservoice forum: https://redgate.uservoice.com/forums/94413-sql-prompt

    Thank you and so sorry for the lacking option!

    Jessica Ramos | Product Support Engineer | Redgate Software

    Have you visited our Help Center?


Sign In or Register to comment.