-
birth date 1900-01-01 00:00:00.000
Hi,all,
How to check the default value set up for datetime field? The reason I am asking is my database
field "birthday" is datetime(8), the default value I set to '' already. Everytime my asp program
have empty birthday or invalid birthdate for this field, the system automaticaly set it to
1900-01-01 00:00:00.000
Do you know what happened?
Thanks!
Betty
-
Well empty isn't a valid value for a date field. SQL Server is interpreting '' to mean that datetime value. This is by design. Use Null instead.
If the field is defined as a datetime field, how can there be an invalid datetime in the field? Can you show an example of what you mean?
Run this to see what I mean:
Select Cast('' as datetime)
Select Cast(Null as datetime)
-
Rowhide,
When I ran
Select Cast('' as datetime)
it does show
1900-01-01 00:00:00.000
When run
Select Cast(NULL as datetime)
It returns NULL.
What should I do to avoid this?
Thanks!
Betty
-
Remove the default from the field. Your ASP code can handle Null values a lot better than pretend dates.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|