ms sql server equivalent of oracle’s decode
oracle’s DECODE function:
DECODE ( exp1, val1, ret1 [, val2, ret2] [, default]
exp1 is an expression
val1 is a matching expression to compare with exp1
if val1 is = exp1, then ret1 is returned
otherwise, additional matching expressions (val2, val3, val4, and so on) is returned
if no match is found and the default expression default is included, then default is returned
ms sql server the equivalent of oracle’s DECODE function, the CASE function:
CASE input_expression WHEN when_expression_1 THEN result_expression_1 [ WHEN when_expression_2 THEN result_expression_2 WHEN when_expression_n THEN result_expression_n ] [ ELSE else_result_expression ] END