How to get CASE statements on fresh lines with indenting?
DataJanitor
Posts: 3 New member
in SQL Prompt
How do I get CASE statements to start on their own line, preferably indented from the line before, rather than starting way, way off to the right when there's a significant amount of stuff before them. Nested CASE statements are nearly unreadable when they're so far off the screen for complex statements.
A simple example:
A simple example:
SELECT
CASE
@SPID = 3 THEN 'th'
@spid = 88 THEN 'bobasdlkfjalk;sdfjalks;djfla;skjfdlkasfjlks' +
CASE
@SERVERNAME = 'bb' THEN 'a'
ELSE NULL
END
ELSE NULL
END AS [test];
SQL Prompt puts that inner CASE way over to the right of where the + is, and the WHEN's are based on the CASE.
What option am I missing?
SQL Prompt puts that inner CASE way over to the right of where the + is, and the WHEN's are based on the CASE.
What option am I missing?
Tagged:
Answers
Tianjiao Li | Redgate Software
Have you visited our Help Center?
Complete script as SQLPrompt does it with these settings - see how far over the WHEN is? on my screen, it's indented 2 in from the inner CASE.
What I would like is the inner CASE to be on a new line, indented 2 in from the previous WHEN, and then the inner WHEN intended two more.
This is a pretty simple example, but I've got real ones where the WHEN is so far over I can't even tell it's there without scrolling.
Formatting style attached, with extension changed to .txt from .sqlpromptstylev2
Tianjiao Li | Redgate Software
Have you visited our Help Center?
https://redgate.uservoice.com/forums/94413-sql-prompt/suggestions/38200615-please-allow-case-statements-to-start-on-their-own