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)
 Select query with case

Author  Topic 

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2010-07-21 : 11:04:11
I am trying to use the following, but getting a message isnull requires 2 arguments:

select Case
when @ServerSysDate < Acct_Exp_dt or isnull(Acct_Exp_dt) = '' then 'true'

Else 'false'

End [TF]
from tab_users where UserName=@UserName

Thank you very much for the helpful info.

cplusplus
Aged Yak Warrior

567 Posts

Posted - 2010-07-21 : 11:44:27
It worked when i used is null

when @ServerSysDate < Acct_Exp_dt or Acct_Exp_dt is null then 'true'

Thank you.

quote:
Originally posted by cplusplus

I am trying to use the following, but getting a message isnull requires 2 arguments:

select Case
when @ServerSysDate < Acct_Exp_dt or isnull(Acct_Exp_dt) = '' then 'true'

Else 'false'

End [TF]
from tab_users where UserName=@UserName

Thank you very much for the helpful info.

Go to Top of Page

jimf
Master Smack Fu Yak Hacker

2875 Posts

Posted - 2010-07-21 : 12:33:09
You should ask your company for access to Books On Line. It's free. The isnull function requires 2 arguments
ISNULL(Acct_Exp_dt,'') = then 'true' else false

Jim

Everyday I learn something that somebody else already knew
Go to Top of Page
   

- Advertisement -