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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Testing for empty date field

Status
Not open for further replies.

NeeNee

Programmer
Apr 2, 2002
97
CA
I have a table with a start and end date field. When the record is first created, a start date is entered but the end date is left empty.
I have been trying to query for the empty end date using the null, spaces and empty string, but I keep getting a data type mismatch.
What do I use in a query to test for an empty date?

Looking for help.


 
You CAN NOT test for null values using the operator "=" because the null value is not realy a value and you can receive strange results testing null values with "=".
As mentioned above, you should use "WHERE EndDate IS NULL" instead.
Also, if you use agregate functions over a column that accepts nulls, you allways should eliminate those. Something like this:
select sum(isnull(Column_Name,0)) for an integer column.

Hope it used!
Bogdan.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top