Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Datetime nulls

Author  Topic 

DavidChel
Constraint Violating Yak Guru

474 Posts

Posted - 2008-10-06 : 16:00:41
My ERP system enters '1/1/1900 12:00:00 AM' when a date hasn't been entered into a field.

I understand why, but is it required? Is there some reason why a datetime field cannot contain a null value?

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-10-06 : 16:15:43
It depends on how the queries are written.
If the vendor uses

BETWEEN Col AND Col2

a value in Col1 is needed.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

mikedakins
Starting Member

2 Posts

Posted - 2008-10-06 : 16:20:08
In the past I have used an iif statment in the query to check for validity of the date and if it isn't put something in which will give the desired results.

Like an integer, a date can't be null because it is impossible (ie a string can be 0 length but an integer must be a number even if it is 0) The date '1/1/1900 12:00:00 AM' is 0.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-10-06 : 16:21:36
In SQL Server, yes. In Access Dec 30, 1899 is Zero.

And yes again, a date can be NULL. NULL is "undetermined".



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -