This project is read-only.


Evaluates a set of Boolean expressions to determine the result.


     WHEN Boolean_expression THEN result_expression 
    [ ...n ] 
    ELSE else_result_expression 


Is a placeholder that indicates that multiple WHEN Booleanexpression THEN resultexpression clauses can be used.
THEN result_expression:
Is the expression returned when Boolean_expression evaluates to true. result expression is any valid expression.
ELSE else_result_expression:
Is the expression returned if no comparison operation evaluates to true. If this argument is omitted and no comparison operation evaluates to true, CASE returns null. elseresultexpression is any valid expression. The data types of elseresultexpression and any result_expression must be the same or must be an implicit conversion.
WHEN Boolean_expression
Is the Boolean expression evaluated when the searched CASE format is used. Boolean_expression is any valid Boolean expression.

Return Value

Returns the highest precedence type from the set of types in the result_expression and the optional else_result_expression.


select value 
       	     when e.Country = 'Chinese' then 'CN',
             when e.Country = 'English' then 'EN',
             when e.Country = 'HongKong' then 'HK',
             else 'other'
from Employees as e

Last edited Mar 25, 2013 at 9:11 AM by ansiboy, version 1


No comments yet.