Articles → SQL SERVER → Case statement in SQL server
Case statement in SQL server
What is the case statement?
Syntax
Case When <condition> then <value_to_be_returned_if_condition_is_satisfied> Else <value_to_be_returned_if_condition_is_not_satisfied> End
Example
Click to Enlarge
Click to Enlarge
Select (Case When Photo is not Null then 'Exists' Else 'Not Exists' End) From [Image]
Click to Enlarge