Please start any new threads on our new site at 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!
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Sql command, several search criteria
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

2 Posts

Posted - 12/04/2013 :  08:51:28  Show Profile  Reply with Quote

I am very new to sql programming. I have a database with 15 columns. At this moment I do this to get all rows containing the year 2013: WHERE DATEPART(yyyy, DownloadDate) = 2013
. But I also want to add a criteria so that I can have all rows where DownloadDate contains 2013 AND WHERE IsRead(BIT) contains NULL. I tried this: WHERE DATEPART(yyyy, DownloadDate) = 2013 AND IsRead = null
. But this gave me nothing!

Thx for help


Flowing Fount of Yak Knowledge

1054 Posts

Posted - 12/04/2013 :  08:55:19  Show Profile  Reply with Quote
use "isRead IS NULL" instead of "= null"

Go to Top of Page

Very Important crosS Applying yaK Herder

52326 Posts

Posted - 12/04/2013 :  09:47:14  Show Profile  Reply with Quote
also make the data filter condition as

DownloadDate > = '20130101' AND DownloadDate < '20140101'

if you want to make use of an existing index on it


SQL Server MVP
Go to Top of Page

Starting Member

2 Posts

Posted - 12/05/2013 :  08:22:22  Show Profile  Reply with Quote
Thanks for all your help. It worked like magic :)
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.11 seconds. Powered By: Snitz Forums 2000