Articles → SQL SERVER → Case Statement In SQL Server

Case Statement In SQL Server

What Is The Case Statement?


Case When <condition> then <value_to_be_returned_if_condition_is_satisfied> Else <value_to_be_returned_if_condition_is_not_satisfied> End


Picture showing schema of Image table
Click to Enlarge

Picture showing data in Image table
Click to Enlarge

Select (Case When Photo is not Null then 'Exists' Else 'Not Exists' End) From [Image]

Picture showing output of case statement in SQL server
Click to Enlarge

Posted By  -  Karan Gupta
Posted On  -  Tuesday, July 18, 2017


Your Email Id  
Query/FeedbackCharacters remaining 250