Ternary Operator in SQL

there technically isn't one, but an equivalent isn't too hard to do

This ternary in C#:
(str.Length > 0 ? "yes" : "no");

Is equivalent to this in SQL:
(CASE WHEN LEN(@str) > 0 THEN "yes" ELSE "no" END);

Add comment

Loading