Case Statement in SQL Server

This blog defines the case statement with a simple example in SQL Server.

--SQL SERVER – CASE Statement- Simple CASE expressions

declare @condition nvarchar(max)

set @condition=1
select
case @condition
when
1 then 'You have 1 Year Expirence'
when
2 then 'You have 2 Year Expirence'
when
3 then 'You have 3 Year Expirence'
when
4 then 'You have 4 Year Expirence'
when
5 then 'You have 5 Year Expirence' 

end

Output

Image1.jpg

Ebook Download
View all
Learn
View all