- Jul 18, 2002
- 1,655
- 1
- 81
Good afternoon all,
I am running into a problem with my program where when I do an insert into TABLE_A with fields ID (PK), NAME (Varchar), SPECIAL_DATE (datetime).
When I insert a null or empty into SPECIAL_DATE SQL Server 2005 gives it a value of 1/1/1900. I know why it does this...because a null or 0 datetime value translates to 1/1/1900.
I need a trigger that can detect the 1/1/1900 0 value and replace it with a SqlDateTime.null .
I know I can detect a null value and insert a SqlDateTime variable with a value of SqlDateTime.null instead which will fix the issue, but the code is too large for that at this point.
How do I do it both for Insert and After Update ?
I am running into a problem with my program where when I do an insert into TABLE_A with fields ID (PK), NAME (Varchar), SPECIAL_DATE (datetime).
When I insert a null or empty into SPECIAL_DATE SQL Server 2005 gives it a value of 1/1/1900. I know why it does this...because a null or 0 datetime value translates to 1/1/1900.
I need a trigger that can detect the 1/1/1900 0 value and replace it with a SqlDateTime.null .
I know I can detect a null value and insert a SqlDateTime variable with a value of SqlDateTime.null instead which will fix the issue, but the code is too large for that at this point.
How do I do it both for Insert and After Update ?