It is not possible to use CASE Expression in Default Values when you add a new column. I hope this answers the question. However, there is a workaround.
Conditional Aggregation: Several Counts in One Pass With CASE
Use conditional aggregation for several ticket counts, avoid COUNT with ELSE zero, and calculate percentages with an explicit denominator.
SQL Puzzle – Unsolved CASE Expression
Lots of people have asked me to share another puzzle. Well, let us see a very simple puzzle of Unsolved CASE Expression in today’s blog post.
SQL SERVER – How to Order By a Parameter?
We figured out that there was a very poor code written in one of the Stored Procedure’s Order By clause. Let us learn today how to order by a parameter.
CASE Expression Pitfalls: NULL Tests and Data Type Precedence
Reproduce CASE expression traps with NULL tests, mixed result types, missing ELSE, and nesting, then apply clear rewrites.



