Mega Code Archive

 
Categories / MSSQL / Select Query
 

CASE

11> 12> -- CASE: return a specified value based on a set of business logic 13> 14> DECLARE @Status Int 15> SET @Status = 1 16> 17> SELECT CASE @Status 18>   WHEN 1 THEN 'Active' 19>   WHEN 2 THEN 'Inactive' 20>   WHEN 3 THEN 'Pending' 21> END 22> 23> GO -------- Active (1 rows affected) 1>