Formatting after JOIN

ArcomArcom Posts: 6
edited April 4, 2014 11:32AM in SQL Prompt
When using SQL Prompt > Format SQL when using the JOIN statement the table name and join condition are indented and placed on the next line (which is my preference).

If I user an INNER JOIN, LEFT JOIN or RIGHT JOIN however, the table name and join condition are placed immediately after the join statements on the same line.

Is it possible to force the INNER JOIN etc. formatting to behave the same way as JOIN?

Comments

  • Aaron LAaron L Posts: 596 New member
    Hi Arcom,
    I'm not sure I'm seeing the same behaviour you've described when I try it here. Would it be possible to post a small script that shows what you're currently seeing and how you'd like it instead?

    Thanks,
    Aaron.
  • Hi Aaron,

    SELECT * FROM Dept d INNER JOIN Employee e ON d.DeptId = e.DeptId

    reformats to
    SELECT
       *
    FROM
       Dept d
    INNER JOIN Employee e ON d.DeptId = e.DeptId
    

    whereas

    SELECT * FROM Dept d JOIN Employee e ON d.DeptId = e.DeptId

    reformats to
    SELECT
       *
    FROM
       Dept d
    JOIN
       Employee e ON d.DeptId = e.DeptId
    

    My preference is for the latter, but I can't find an option to set this

    Thanks

    Andy
  • Aaron LAaron L Posts: 596 New member
    Thanks for the example!

    I've logged this request as SP-5079 in our internal tracking system. We will be looking to improve the flexibility of the formatting system in Prompt in the future so this request will be helpful when we consider the list of rules.

    If you have any more suggestions please feel free to post them here!

    Thanks,
    Aaron.
Sign In or Register to comment.