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 2008 Forums
 Transact-SQL (2008)
 Verify Where only if not null
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

mike13
Posting Yak Master

Netherlands
219 Posts

Posted - 03/13/2013 :  01:46:37  Show Profile  Click to see mike13's MSN Messenger address  Reply with Quote
Hi all,

i got this statement

SELECT @couponID=id,@value=value, @percent=[percent]
FROM T_Order_Coupon
WHERE (active = 1) and siteid=@siteid and coupon=@coupon AND expdate<=GETDATE()

But i only want to use the where clause expdate<=GETDATE()
if column expdate is not NULL

How do i do that?

thanks a lot,

visakh16
Very Important crosS Applying yaK Herder

India
52326 Posts

Posted - 03/13/2013 :  01:53:21  Show Profile  Reply with Quote

SELECT @couponID=id,@value=value, @percent=[percent]
FROM T_Order_Coupon
WHERE (active = 1) and siteid=@siteid and coupon=@coupon AND (expdate<=GETDATE() or expdate is null)


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

mike13
Posting Yak Master

Netherlands
219 Posts

Posted - 03/13/2013 :  05:13:00  Show Profile  Click to see mike13's MSN Messenger address  Reply with Quote
Thanks a lot!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52326 Posts

Posted - 03/13/2013 :  06:41:25  Show Profile  Reply with Quote
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

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.04 seconds. Powered By: Snitz Forums 2000