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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s