Improve SQL code formatting options
SQL Prompt 8.0 includes many improvements to the SQL formatting options. For additional information see: http://documentation.red-gate.com/display/SP8/SQL+Prompt+8.0+release+notes
You can get the latest version of SQL Prompt from http://www.red-gate.com/products/sql-development/sql-prompt/
Thank you for your help!
-
Stuart Branham commented
This gets 100% of my votes. I can't really use it the way I like to format SQL as-is. What would be absolutely killer is if SQL Prompt gave me a bunch of queries to format manually, and then figured out my formatting scheme from those.
Here's how I like it, for reference: http://pastebin.com/ct0mBVcn
-
Peg commented
Allow join clause to stay on same line as table:
select t1.col1, t2.col2
from tbl1 t1 inner join
tbl2 t2 on t1.col1 = t2.col1 -
Josh commented
I would also like to have SEPARATE formatting layout options for subqueries versus outer queries. Perhaps even a fine "template" of some sort applied to each statement/keyword (select, insert, declare/set, cursor, CTE, etc). This would really allow us to specify the exact formatting of any given keyword or statement.
-
Rajmund Rzepecki commented
When indenting table names in a separate line than "from", please also support a formatting option when a join is in separate line with object name indentation at next line. That seems more readable than lump sume type of join with object and conditions all together. Conditions if long (more than one =) may need to also go split into subsequent lines aligned with object name of first condition on preceding line. Examples below:
from
dbo.personnel
inner join (example 1)
ab on personnel.a = ab.a
left join (example 2)
ac on personnel.a = ac.a
and ac.type = 1
and ac.before = '01/01/2011'
left join (example 3)
ac on personnel.a =
ac.a
and ac.type = 1
and ac.before = '01/01/2011'
left join (example 4)
ac
on personnel.a = ac.a
and ac.type = 1
and ac.before = '01/01/2011'
left join (example 5)
ac
on personnel.a = ac.a
and ac.type = 1
and ac.before = '01/01/2011' -
Bright commented
Currently, there is no formatter option to indent opened parenthesis of the subquery (parenthesis is in the new line) on the same indentation level as the line before. Of course, subquery inside the parenthesis should be indented for 1 level relative to parenthesis. E.g. formatiing like this:
SELECT something
from table t1
where t1.id =
(
select max(id)
from otherTable
)Opened parenthesis is on the same identation level as "where". There is no way to achieve this in sql prompt 4.0.3.12