GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO
Create proc [PROC_SAMPLE_Case]
as
begin
SET NOCOUNT ON
Declare @temp table(
id int,
name varchar(50)
)
insert into @temp values(1,'A')
insert into @temp values(2,'B')
insert into @temp values(3,'C')
insert into @temp values(4,'D')
Select id,
case name when 'A' then 'Apple'
when 'B' then 'Boy'
when 'C' then 'Cat'
else 'Dog' end name
from @temp
End
you just have to run the above script then see the result....I hope...it will clear your doubt regarding the concept of case statement in the SQL..
and after that execute the following line code in sql...
Exec PROC_SAMPLE_Case
Sourabh07
Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator