Connecting Tech Pros Worldwide Help | Site Map

CASE stmt with isnull()

Member
 
Join Date: Nov 2006
Posts: 42
#1: Apr 23 '08
select country,
IsNull(A,0) as A,
IsNull(B,0) as B,
---- Here I need to add case stmt. I have data B in Db if it is B then I have to show C else I have to C

from <Table-name>

Please help me how to do this? It is very urgent

Thanks
ck9663's Avatar
Expert
 
Join Date: Jun 2007
Posts: 1,925
#2: Apr 23 '08

re: CASE stmt with isnull()


Quote:

Originally Posted by siddu

select country,
IsNull(A,0) as A,
IsNull(B,0) as B,
---- Here I need to add case stmt. I have data B in Db if it is B then I have to show C else I have to C

from <Table-name>

Please help me how to do this? It is very urgent

Thanks


Use CASSE

-- CK
ganeshkumar08's Avatar
Newbie
 
Join Date: Jan 2008
Posts: 31
#3: Apr 23 '08

re: CASE stmt with isnull()


Hello

Try this..

select country,
IsNull(A,0) as A,
IsNull(B,0) as B,
-- My code
case when isnull(B,0) < = 0 then C else C End as 'C'
from <Table-name>

If this is not ok, please explain me clearly i write and give u...

Ganesh
Reply


Similar Microsoft SQL Server bytes