Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I Test a Date Field for Null?

Status
Not open for further replies.

WindUp

Programmer
Mar 6, 2003
100
0
0
US
It seems straight forward enough to use
Code:
IsNull(TableName.DateFieldName)
in an SQL Statement. Here's a section of my SQL Statement...
Code:
WHERE ( (IsNull(TableName.DateFieldName) OR (Year(TableName.DateFieldName)>2000) )
Gives me the following error...
Code:
Crystal Reports ActiveX Designer error '80047e52' 

Failed to open a rowset. Details: ADO Error Code: 0x80040e14 Source: Microsoft OLE DB Provider for SQL Server Description: The isnull function requires 2 arguments. SQL State: 42000 Native Error: 174

The Help file for CR uses it just like that (with One argument, but the error message says it requires TWO arguments); Any advice?

Thanks!


Good Luck! [thumbsup2]
WindUp
 
That's not the right syntax for SQL Server, you're using Crystal Isnull.


The SQL Server ISNULL() has 2 parts:

isnull(datefield,<default value if null>)

What you want in T-SQL (SQL Server) is:

WHERE TableName.DateFieldName is null

-k
 
>What you want in T-SQL (SQL Server) is:
WHERE TableName.DateFieldName is null


That did it! I thought I had already tried that earlier, but &quot;Ah must'a made'a typin' mistake.&quot;[sub](said in a hillbilly accent)[/sub]

Thanks!



Good Luck! [thumbsup2]
WindUp
 
A-yup, thars faaarrr too many of them letters-n-stuff on them thar keyboards...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top