- September 25, 2009 at 8:20 am #317
Inserting or updating data into a database table with a field of type “datetime”, where no data is updated from the form expectation is that NULL should be stored in the database table.
However when the database is queried later, with a SELECT action it returns, but 1900-01-01 00:00:00.000
This is ‘expected’ behaviour of SQL The dynamic query will insert default value for date and this can only be handled with a stored procedure where you check for null or empty string and set it with their own value or NULL. This limitation is not because of Perfectforms but because of how MS-Sql works.
See below the example for the sql stored procedure example:
ALTER PROCEDURE InsertDateTimeNullTest
— Add the parameters for the stored procedure here
@DOB datetime = null
IF @DOB = ” OR @DOB IS NULL
SET @DOB = NULL
— Insert statements for procedure here
INSERT INTO [DateTimeNullInsertTest] (
You must be logged in to reply to this topic.