|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
MSSQL Default Date Value
Is there a setting to make smalldatetime or any date data type field default to NULL?
Currently it is defaulting to 1/1/1900 anytime the record is updated or inserted. I can set the default to the current date, but really we want that blank until it is filled in. |
|
#2
|
||||
|
||||
|
Check how your table is defined
__________________
My blog Tutorials about OSS databases, DBMonster ... Contribute to OSS Development, fill bug reports! Developer Shed eSupport Commented my.ini/my.cnf (ADD YOUR OWN CONFIG TRICK) An introduction to database normalization Natural or Surrogate key Custom ordering for your results Correlated and uncorrelated subqueries Don't turn your outer joins into inner joins Random data (with a bias) |
|
#3
|
||||
|
||||
|
Check how you're updating the table. If it's updating it to an empty/null string (''), SQL will convert it to that date. It will do the same thing with an integer zero, but "null string means null" is a more common mistake. NULL means NULL. It is a very explicitly different value than ''.
__________________
Andrew - Perl (and VB.NET) Monkey Never underestimate the bandwidth of a hatchback full of tapes. |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > MSSQL Default Date Value |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|