Monday, March 12, 2012

Nested case?

IS it possible to use nested case statement in TSQL,if yes what is the syntax of it

I m using SQL 2005

thanx

its possible...here is an example/syntax...

declare @.var1 int

declare @.var2 int

set @.var1 =1

set @.var2 =1

select

CASE @.var1

WHEN 1

THEN(

CASE @.var2

WHEN 1 THEN(

100)

ELSE 99

END)

ELSE 98

END

|||thanx very much.... this is the thing i asked for

No comments:

Post a Comment