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
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 Why can't store null value in date column

Author  Topic 

Ish
Starting Member

11 Posts

Posted - 2010-07-22 : 15:24:36
Hi

Sorry for this silly question. I am very new to sqlserver.
I have a table with a field date type. I have define this field to hold null value. But when I create a record, it put "1900-01-01" value to this field, instead of null.

Please could someone help, how to set this date type field to hold null value, instead of value 1900-01-01.

Many thanks

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-07-22 : 15:54:35
I think you err.
If you put NULL into the date column then it will be NULL.
If you put an empty string into the date column then it will become 1900-01-01.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-07-22 : 15:55:27
is there a default constraint?

how are u creating the record?
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-07-23 : 04:21:31
Yes. You send '' instead of NULL. Read this post too
http://beyondrelational.com/blogs/madhivanan/archive/2008/09/02/empty-string-and-default-values.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -