How To Use a CASE Statement In T-SQL



TODO:

Have you ever wanted to use a CASE statement in your T-SQL Select Query?

 

SOLUTION:

SELECT   Column = 
      CASE 
         WHEN SomeValue =  0 THEN 'Zero'
         WHEN SomeValue < 0 THEN 'Minus'
         ELSE 'Plus'
      END
FROM MyTable

 

NOTES:

There are no notes on this topic.



Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading