I am using SSIS to copy data from a table in Oracle to a table in SQL Server 2005. There’s no transformation required, so it’s just a straight line connecting OLE DB Source to OLE DB Destination. Fairly simple and works, but during execution, a record in the Oracle table contains a timestamp value of the year 0002 in encountered, so SSIS errors out due to an oveflow exception.
If I create an extra column in SQL Server with the data type of string, and remap, then that works fine. However, I prefer to keep the Datatime column and use it in my destination. I am OK with replacing the year 0002 with something like 1900 or something like that. So what’s the best way to achieve this if-then-else in SSIS?
I usually let Oracle deal with that by using something like this in my source query:
This sets a valid but very future date (dictated by the company I am on contract to as the representation of an invalid date in a required date field. You could also use
'1900-01-01 00:00:00'instead of'9999-12-31 00:00:00') in cases where the original date isnullor less than1900-01-01 00:00:00. It also avoids post processing by SSIS on the date field.