Comments
5 comments
-
mcair wrote:I've been looking for something like this for a long time, often wasting significant time "cleaning-up" some lazy, long-gone developer's sloppy T-SQL code so that it is somewhat readable and ready for re-factoring.
Options I'd like to see:-
Convert spaces to tabs (i.e. convert n spaces into a tab)
Left-align all lines of code to tab-stop n (where n can be 0,1,2 etc.)
Align datatype identifiers in DECLARE blocks
Align = signs in WHERE clauses
New line for each expression in a WHERE clause
capitalize reserved words: WHERE, JOIN, FROM, SELECT, INSERT etc.
New line for each column listed in a statement
Incremental indent of nested IF statements
If any/all of these items get into the product I'd probably reach into my pocket and buy it....
Hi,
we have a separate refacotring for "capitalize reserved words: WHERE, JOIN, FROM, SELECT, INSERT etc.", It is called Uppercase keywords. You can invoke it either from the menu or by pressing Ctrl-B Ctrl-U.
For "New line for each column listed in a statement" is the default behaviour, but it can also be customized in the Options section.
"Incremental indent of nested IF statements" is already there as the default behaviour.
"New line for each expression in a WHERE clause" is in, please have a look at the "Expressions -> Operatior Placement -> On a new line" option.
While the rest we do not have yet, we will consider them for future versions.
Regards,
Andras -
Thanx for the quick response, and please excuse my not discovering the features you mentioned.
One question: when I select "Lay Out SQL" it automatically indents everything after "AS" by one tab-stop?
BTW, the "Summarize Script" feature is awesome! -
mcair wrote:Thanx for the quick response, and please excuse my not discovering the features you mentioned.
One question: when I select "Lay Out SQL" it automatically indents everything after "AS" by one tab-stop?
BTW, the "Summarize Script" feature is awesome!
Thank you for your support.
Concerning your question, could you give us an example? Note that we have over 30 options to control the behaviour of SQL Lay Out (these you can access vie the SQL Refacor->Options menu item. They have previews too and some explanatory text which may answer your question.
Regards,
Andras -
CREATE PROCEDURE [dbo].[mysp]
as
select cola from tablea ta join tableb tb on ta.keycol = tb.keycol
will be laid out with the select statement tab-indented when I wanted it to start at pos 0. -
mcair wrote:CREATE PROCEDURE [dbo].[mysp]
as
select cola from tablea ta join tableb tb on ta.keycol = tb.keycol
will be laid out with the select statement tab-indented when I wanted it to start at pos 0.
Hi,
I see. We handle stroed procedure content as nested content, so we indeed indent it. However I understand that this is a common formatting style, so we will consider this option for a future release (we have frozen features for the current release)
Many thanks for your feedback,
Andras
Add comment
Please sign in to leave a comment.
Options I'd like to see:
Convert spaces to tabs (i.e. convert n spaces into a tab) Left-align all lines of code to tab-stop n (where n can be 0,1,2 etc.) Align datatype identifiers in DECLARE blocks Align = signs in WHERE clauses New line for each expression in a WHERE clause capitalize reserved words: WHERE, JOIN, FROM, SELECT, INSERT etc. New line for each column listed in a statement Incremental indent of nested IF statements
If any/all of these items get into the product I'd probably reach into my pocket and buy it....