Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

Importing text file with Date field - Format is Misinterpreted

$
0
0

I have created a SSIS package (SSIS 2008 R2) that imports a flat file into a sql server database.
I am having difficulty in loading a date field (OrderDate) into the sql server table and obtaining the correct output.

Here is some sample input  / output

Sample Flat File                                 Output Sql Server

2011-08-08 10:31:24.133                   2010-11-15 08:02:50.0000000
2011-08-08 12:50:44.623                   2010-08-10 11:38:33.0000000                                       
2011-08-09 10:03:07.873                   2010-07-01 12:52:12.0000000

For some reason the entire date is being misinterpreted.

The datatype of the source field is date date[DT_DATE]
Format of source field:  YYYY-MM-DD HH:MM:SS.MS
Datatype of sql server table column: datetime2

My Package contains the following Transformations:
1. Flat File Source
2. Derived Column Transform
3. Data Conversion Transform
4. OLEDB Destination

I have viewed the data with Data Grids and it looks like the original source throughout the package transforms. But when it is viewed in sql server it looks like I have shown above (SQL SERVER Output)

My understanding is that this is the ISO standard format and should be
handled easily by sql server.

I have tried executing a SET DATEFORMAT YMD before executing the package. This does not correct the problem.

Thanks for your help,

Don


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>