SQL Server CASE Function
Evaluates a list of conditions and returns one of multiple possible result expressions
Begin
Declare @Position Int;
Set @Position = 3
Select Case @Position
when 1 then 'Gold'
when 2 then 'Silver'
when 3 then 'Bronze'
Else cast(@Position as varchar)+ 'th'
End as Medal
End
You can change the value of @Position and analyse the output
SQL Server CASE Function, CASE Function, CASE Function Example
Showing posts with label CASE Function. Show all posts
Showing posts with label CASE Function. Show all posts
Saturday, April 28, 2007
Subscribe to:
Posts (Atom)