Formatting after JOIN

Provides intelligent code completion for SQL Server editors.

Moderators: Anu Deshpande, Aaron Law, David Priddle

Formatting after JOIN

Postby Arcom » Fri Apr 04, 2014 10:10 am

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?
Arcom
 
Posts: 2
Joined: Fri Apr 04, 2014 10:04 am

Postby Aaron Law » Fri Apr 04, 2014 2:33 pm

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.
Aaron Law
 
Posts: 249
Joined: Fri Jun 28, 2013 10:56 am
Location: Red Gate Software

Postby Arcom » Fri Apr 04, 2014 3:14 pm

Hi Aaron,

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

reformats to

Code: Select all
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

Code: Select all
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
Arcom
 
Posts: 2
Joined: Fri Apr 04, 2014 10:04 am

Postby Aaron Law » Fri Apr 04, 2014 4:32 pm

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.
Aaron Law
 
Posts: 249
Joined: Fri Jun 28, 2013 10:56 am
Location: Red Gate Software


Return to SQL Prompt 6

Who is online

Users browsing this forum: No registered users and 0 guests