Sunday, February 19, 2012

Allowing for blank fields in date text boxes

Several textboxes are being on a web form for date entry. and we want to allow the user to leave date fields blank (if particular date is unknown). However, when the field is left blank, the SQL Server 2000 database defaults to 1/1/1900 (datatype = datetime).
My question is as follows: How is it possible to leave a date textbox field blank, and either send 00\00\0000 or spaces to the SQL Server 2000 database datetime field?
Any advice/insight is appreciated! RobEDIT
Both Datetime and SmallDatetime allow NULLs Datetime is 8bytes while Smalldatetime is 4bytes but its resolution is limited. If you want Time Span you have to use DateTime.
when you are using NULL with Datetime you must use COUNT (*) in all you calculations because all SQL Server aggregate functions ignore NULLs except COUNT (*).
Hope this helps.|||Check outthis article

No comments:

Post a Comment