SQL Prompt - strange behavior with ROLLBACK TRANSACTION
Guenter
Posts: 12 Bronze 1
in SQL Prompt
Hello,
in my stored procedures I often use the pattern
in my stored procedures I often use the pattern
IF @somecindition = TRUE BEGIN COMMIT TRANSACTION; END; ELSE BEGIN ROLLBACK TRANSACTION; END;</code>IF @somecondition = TRUE BEGIN COMMIT TRANSACTION; END; ELSE BEGIN ROLLBACK TRANSACTION; END;</pre><div>When I use SQL Prompt to format this code, the COMMIT TRANSACTION statement is correctly indented (as being in a BEGIN END block), but the ROLLBACK TRANSACTION always ends up in the first column, regardles of the depth of BEGIN/END blocks it is in, like this:<br><br></div><pre class="CodeBlock"><code>
Why is this, and how can I force SQL Prompt to indent ROLLBACK as it does with COMMIT?
Tagged:
Answers
Hi @Guenter
Thank you for reaching out on the Redgate forums regarding your SQL Prompt formatting.
Unfortunately, the formatting of your code in your post appears to be mixed up and isn't clearly identifying your request.
Are you able to provide a screenshot of your snippet pre- & post-formatting, so we can better understand what is occurring
My initial area of investigation would be the Control Flow section of your Style formatting. Modifying settings here does affect the spacing & positioning of Begin/End blocks
If you can provide a screenshot of what is occurring in your formatting, it would be helpful for us to better determine the formatting style setting change that may help solve your inquiry.
Hi Jan,
thank you for your post. If the formatting output on my computer were as you show it, I'd be really happy.
But my output looks different: