Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 modified ISNULL check

Author  Topic 

magmo
Aged Yak Warrior

558 Posts

Posted - 2013-04-03 : 17:08:04
Hi

I have this condition in a query..


ISNULL(dbo.RS.ID, 0) AS UseValues,


But I would like to display 0 if its null otherwise it should display 1, what do I need to change?

chadmat
The Chadinator

1974 Posts

Posted - 2013-04-03 : 17:15:54
CASE WHEN dbo.RS.ID IS NULL THEN 0 ELSE 1 END

-Chad
Go to Top of Page

magmo
Aged Yak Warrior

558 Posts

Posted - 2013-04-04 : 00:19:14
Thank you very much!
Go to Top of Page

chadmat
The Chadinator

1974 Posts

Posted - 2013-04-04 : 12:54:34
You are welcome.

-Chad
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2013-04-04 : 16:35:15
[code]ISNULL(SIGN(ID), 0) AS UseValues,[/code]


N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
   

- Advertisement -