SQL Server: SSIS and SQL Update command does not import Null for DateTime column

I used SSIS to create a Table and import data into the database. A couple of columns are DateTime field and the values are blank for some. I noticed that the result was that the following value “1753-01-01 00:00:00.000 ” was placed in the fields. I tried using the SQL Update command and that made no difference. Here is the solution

SSIS

  1. Open the SSIS package file with Notepad.
  2. Search for “Retainnulls“. Set it to true.

SQL Command

Run the Update command like this

set startdate = cast(‘2017-01-30 00:00:00.000’ as datetime)
where Employeeid = ‘5551212’

Advertisements