Disable SQL Prompt on certain blocks of code
Add a functionality of disabling SQL Prompt auto-formatting feature for blocks of code. Use SQL comments for 100% sql compatibility. Example:
SELECT 1, 2, 3
select 4, 5, 6
in the code above, the first and third statements would be auto-formatted but not the second one.
It would be especially useful for very long scripts where a single formatting template is not an option.
between the begin tag and the end tag SQL Prompt leaves the code untouched because of my specific format needs
I'd liek a way to prevent a section of SQL code being formatted
For example, I have some long case statements with very short when clauses and I'd prefer not to format these as a normal case statement.
Many formatters allow you to insert a NOFORMAT comment or similar
Richard Wells commented
We commonly have a block like this at the top of a file:
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].[vwMyView]') AND OBJECTPROPERTY(id, N'IsView') = 1)
DROP VIEW [dbo].[vwMyView]
But our normal code is more spread out vertically. Format SQL blows this up. I have to select the CREATE VIEW separately and format that. (Workable, but slow.)
A comment-embedded <SQLPrompt:NoFormat> pragma would be perfect here.
Tom Pester commented
Prompt does and excellent job in 90% of the times. In 10 % it makes some statements too verbose layout wise. Consistency is generally a good thing but now always.
This is one of the last basic features that I miss. It already has a lot of excellent advanced features.
I hope it makes the next beta. I voted 3 points.
mike hills commented
cant wait for this:-)
I have complex insert scripts and have to use sql designer to open and close them to reduce space prior to printing
Any feedback on plans for this request? I know there are alot of other possible formating requests out there but this would atleast give a workaround to those shortcomings if the formating could be frozen around some areas.
should it use the multi-line comment instead? /*<SQLPROMT disable>*/
david rawheiser commented
I would like to vote this up if possible - Sometimes you have bulk inserts that shouldn't be wrapped or complex SQL that is easier to understand if formatted in a logical and not syntactical manner. The Java format processor uses a tag in a comment @formatter:off and then @formatter:on.
Good idea. I'd like to also suggest that we would disable Code Suggestions for an entire single file. I want it on for the other pages as I research or refactor the page that contains huge amounts of dynamic SQL. I want the code suggestions to work on the other pages.