Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why is TIMESTAMP fractional seconds off by .001 when exported from DB2 to MSSQL data type DATE, DATETIME, TIMESTAMP not as VARCHAR()

When I export TIMESTAMP data type from DB2 to MSSQL data types DATE, DATETIME or TIMESTAMP the fractional time is off by .001. If I export as data type VARCHAR() I get the correct data. Is there an explanation and/or solution for this?
I have exported through SSIS and PENTAHO.

DB2 2021-10-20-21.31.41.138000

MSSQL 2021-10-20 21:31:41.137

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Thank you in Advance

>Solution :

The result you have is completely expected.

datetime is accurate to 1/300th of a second, so the value is expected. The closest you can get to 2021-10-20-21.31.41.138000 in a datetime is 2021-10-20T21:31:41.136666666666~ which is represented as 2021-10-20 21:31:41.137.

If you want the value to be accurate to 1/100000 of a second, use a datetime2(6), which could accurately store the value 2021-10-20T21:31:41.138000.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading