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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 modified ISNULL check
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

magmo
Aged Yak Warrior

558 Posts

Posted - 04/03/2013 :  17:08:04  Show Profile  Reply with Quote
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

USA
1974 Posts

Posted - 04/03/2013 :  17:15:54  Show Profile  Visit chadmat's Homepage  Reply with Quote
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 - 04/04/2013 :  00:19:14  Show Profile  Reply with Quote
Thank you very much!
Go to Top of Page

chadmat
The Chadinator

USA
1974 Posts

Posted - 04/04/2013 :  12:54:34  Show Profile  Visit chadmat's Homepage  Reply with Quote
You are welcome.

-Chad
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

Sweden
30421 Posts

Posted - 04/04/2013 :  16:35:15  Show Profile  Visit SwePeso's Homepage  Reply with Quote
ISNULL(SIGN(ID), 0) AS UseValues,



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000