Simple CASE
statement, where CASE expression compares the given conditional value to
determine the result.
Search CASE
statement, where CASE expression evaluates a set of Boolean expressions to
determine the result
Some
important points:-
CASE
statement supports optional ELSE argument.
In the case
of not supplying ELSE argument, NULL will be taken as default value for
ELSE.
CASE can be
used in any statement like SELECT, UPDATE, DELETE, SET and in clauses like
SELECT_LIST IN, WHERE, ORDER BY, HAVING.
SQL Server
allows for only 10 levels of nesting in CASE expressions.
The CASE
expression cannot be used to control the flow of execution of Transact-SQL
statements, statement blocks, user-defined functions, and stored
procedures.