Bashar Al-tekreeti
Bashar Al-tekreeti

Reputation: 5

Load Datetime column in SQL server 2012 using SSIS

I'm looking to load a transaction file from a flat file to database. the file contain datetime column which is displayed like this "20160307092701" and I want to display it in the database like "2016-03-07-09-27:01" using SSIS.

I choose my database column to be set as smalldatetime and on the source file and I convert it DT_DBTIME but it showing NULL values when I load the data to SQL server. I have tried all the possible date option in SSIS but still showing Null value.

Check the Error in SQL server:

Check the Error in SQL server

Upvotes: 0

Views: 744

Answers (1)

user847990
user847990

Reputation:

The format you show you want cannot use smalldatetime because that is not the format of the data type you selected on your destination table. The destination date format would be like 2016-03-07 09:27:00, but if you want it as 2016-03-07-09-27:01 then you will have to store that as a string in your table.

As well the input value is returning a NULL because SSIS cannot convert that format into a date. You would have to use an expression or Script Task of some sort in order to parse that value out to the end format you want it, before sending it to your destination.

Upvotes: 3

Related Questions