By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,105 Members | 1,048 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,105 IT Pros & Developers. It's quick & easy.

null date/time value

P: n/a
I have a table with a date/time field that is not required. The actual
purpose of the field is to indicate when something was stopped.
Therefore, in my select
select field1, field2, dtfield from table
where dtfield > 0 returns the wrong records

If tried null and nz but only get errors from odbc

Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
William Kossack wrote:
I have a table with a date/time field that is not required. The actual
purpose of the field is to indicate when something was stopped.
Therefore, in my select
select field1, field2, dtfield from table
where dtfield > 0 returns the wrong records

If tried null and nz but only get errors from odbc


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Since the column is a DateTime data type why not use expressions that
evaluate DateTime data types. You've set up your query to evaluate a
DataTime against an numeric data type.

Perhaps something like this:

SELECT Col1, Col2, DateColumn
FROM TableName
WHERE DateColumn IS NOT NULL
AND DateColumn > '2004-01-01'

Supply a default date (in this case 1 Jan 2004) instead of ZERO. In
different RDBMS ZERO can refer to different dates (in JET [Access] dbs
ZERO = 30 Dec 1899, in SQL Server ZERO = 1 Jan 1900).

- --
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQGxoQIechKqOuFEgEQINHACeKa6OA+MMgGE8DhyRWY27A5 K6InUAoJJi
IlRbs6B5PV1qRkRt+Ua3uOn+
=EuxH
-----END PGP SIGNATURE-----

Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.