0

I'm trying to import some data from one database to another. Everything works fine except for the milliseconds are being rounded off to its nearest second.

In my SSIS package, I have a Recordset Destination which stores the result of a query into a global object variable. The data viewer shows that the date with all its time component (including milliseconds) are properly being displayed. This is inside a data flow task. After this, I've added a script task which takes the variable that stored the result in the Recordset Destination task. I've used OleDbDataAdapter to get the read the rows from this variable to a locally defined DataTable. When this is done the milliseconds in any of the DateTime field gets rounded to second. Any clues why this is happening and how this can be fixed?

EDIT: Used a for each container task to go through all the rows from the recordset variable. Its still rounding the milliseconds to nearest second.

NOTE: I'm using SSIS 2008, .NET 3.5SP1. The Recordset Destination has DT_DBTIMESTAMP data type of the date time fields.

rageit
  • 3,513
  • 1
  • 26
  • 38
  • I see you mention the datatype that's tied to the database, but what's the defined type on the column holding this field in the DataTable? Make sure it's not int. Are your values actually being rounded, or are they being mistakenly truncated? This is a telltale sign. – B L Oct 04 '13 at 18:35
  • Right now the columns and rows are auto populated by the OleDbDataAdapter and the datatype is DataTime. The values are being rounded, not truncated. – rageit Oct 04 '13 at 18:47

1 Answers1

0

Instead of using the DateTime type used a string type and for that added a new column using derived column and then casted it back to datetime type before making the save call. Could have retrieved datetime as string from the source itself as well.

rageit
  • 3,513
  • 1
  • 26
  • 38