SQL Server Forums
Profile | Register | 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
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

mike13
Posting Yak Master

Netherlands
211 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
52317 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
211 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
52317 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  
 New 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.05 seconds. Powered By: Snitz Forums 2000