Comments
6 comments
-
Do you mean that everything inside the BEGIN and END blocks has no indentation? I have been seeing this as well.
-
Correct
-
When you say its not formatting "correctly" - how do you think it should be being formatted?
If I use default_lowercase on 9.2.9 I get this result with indentations:
If you're not on the latest version trying updating and test again. -
I am on the latest (9.2.9.6459) and it wasn't formatting correctly on the previous version. In the previous version it was basically the opposite problem where everything was spread way out.
In this version everything is all left justified.
This is what is looks like after being formatted:IF @CalculateHeld = 'Yes' BEGINSELECT * FROM [#HeldFunds] WHERE [HeldAmount] > 0DROP TABLE [#HeldFunds]END ELSE BEGINSELECT * FROM [#HeldFunds2] WHERE [HeldAmount] > 0DROP TABLE [#HeldFunds2]END
What it should look like is this:IF @CalculateHeld = 'Yes' BEGIN...SELECT * FROM [#HeldFunds] WHERE [HeldAmount] > 0...DROP TABLE [#HeldFunds]END ELSE BEGIN...SELECT * FROM [#HeldFunds2] WHERE [HeldAmount] > 0...DROP TABLE [#HeldFunds2]END
-
Are you using a default style or a custom style?
-
With my style, I get this:
<div>IF @CalculateHeld = 'Yes'</div><div>BEGIN</div><div> SELECT *</div><div> FROM [#HeldFunds]</div><div> WHERE [HeldAmount] > 0;</div><div> DROP TABLE [#HeldFunds];</div><div>END;</div><div>ELSE</div><div>BEGIN</div><div> SELECT *</div><div> FROM [#HeldFunds2]</div><div> WHERE [HeldAmount] > 0;</div><div> DROP TABLE [#HeldFunds2];</div><div>END;<br></div>
What I'd suggest is look at the whitespace and the control flow sections. Watch out for checking the "wrap if longer than" items. I've had some strange behavior here when these are applied with certain values.
Add comment
Please sign in to leave a comment.
IF @CalculateHeld = 'Yes' BEGIN