I am using SSIS to insert a Excel file into a Sql Server Table. I believe it uses the Bulk insert, and as a result it doesn’t insert into the ‘CreationDate’ and the ‘ModificationDate’ columns (both of which are computed columns with getdate() as the default).
Is there a way to get around this problem?
Also, just to be clear – both these date columns are not a part of excel. Here is the exact scenario:
My excel has two columns – code and description. My SQL Server table has 4 columns Code, Description, CreationDate, ModificationDate.
So, when the SSIS copies the data, it copies Code and Description, but the CreationDate and ModificationDate (which are SQL Server Computed Columns) are both empty.
You should use a normal column with a default constraint if you want to log creation
A computed column defined as
GETDATE()will change every time you query it.It is also impossible for a computed column to not be populated
So, assuming you mean “normal column with default”, then you need stop sending NULL from SSIS which overrides the default
This is all demonstrated here:
Assuming you are using the Bulk Insert Task in SSIS, then you need to set “Keep nulls = off/unchecked” in the options page