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
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment