How to get CASE statements on fresh lines with indenting?

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:

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?
Tagged:

Answers

Sign In or Register to comment.