SQL Complete Single-Line Case When statements
Posted: Thu 03 Aug 2017 19:39
When I am writing CASE WHEN statements in my SQLs, I often have one of 2 cases happening - Either it is a simple one-liner:
Or it is a HUGE case when based upon a series of conditions.
What I would like is that if it is a huge case when to have standard formatting (indent each case, then and end etc). However, if it is a short 1-liner, to not split it into multiple lines with indentation.
I've tried playing with the margin size, but it still breaks up my one-line CASE WHENs into multiple lines.
Is there a way to accomplish what I'm asking for?
Code: Select all
CASE WHEN XXX = 1 THEN yyyy ELSE zzzz END AS Transform
What I would like is that if it is a huge case when to have standard formatting (indent each case, then and end etc). However, if it is a short 1-liner, to not split it into multiple lines with indentation.
I've tried playing with the margin size, but it still breaks up my one-line CASE WHENs into multiple lines.
Is there a way to accomplish what I'm asking for?