Expose all formatting options in the UI
There appears to be several items (BEGIN and END tabbing, table declaration placement, number of tabs for the join condition...etc.) that happen automatically when you click Refactor that Format SQL that you can't configure in the UI.
This feature is now included in the new SQL Prompt 8.0. 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!
-
Rick commented
Add option for create / alter procedure to have parameters below create/alter statement and indent them.
-
Phil Murwin commented
This is also an issue for me, pretty much the only thing preventing me from being able to convince my employer to purchase this product for our devs.
-
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' -
Colby Severson commented
Obviously there is some detection going on that is indenting the BEGIN and END statements and there is something that is putting spacing between the SELECT, FROM, and WHERE statements to indent them a bit, but I can't find anything in the UI options to control this.
-
Colby Severson commented
The best I can get is this:
SELECT~~T.[Name],
~~~~~~~~T2.[Description]
FROM~~~~Test T WITH (NOLOCK)
~~~~~~~~INNER JOIN Test2 T2 WITH (NOLOCK)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ON T.Test2ID = T2.Test2ID
WHERE~~~T.TestID = 1 AND
~~~~~~~~T.[Name] NOT LIKE '%A%'DECLARE @Test INT
SET @Test = 0
IF @Test = 0
~~~~BEGIN
~~~~~~~~SET @Test = 1
~~~~END -
Colby Severson commented
Ex.
Say I want to format the code like this (~ replace spaces and tabs):SELECT T.[Name],
~~~~~~~~T2.[Description]
FROM Test T WITH (NOLOCK)
~~~~~~~~INNER JOIN
~~~~~~~~Test2 T2 WITH (NOLOCK)
~~~~~~~~~~~~~~~~ON T.Test2ID = T2.Test2ID
WHERE T.TestID = 1 AND
~~~~~~~~T.[Name] NOT LIKE '%A%'DECLARE @Test INT
SET @Test = 0
IF @Test = 0
BEGIN
~~~~~~~~SET @Test = 1
END