How to convert CYYMMDD to YYYY-MM-DD in SSIS?

232 Views Asked by At

I have data in a CYYMMDD date format which I need to convert into YYYY-MM-DD in SSIS Package. How to achieve this? Any help will be appreciable.

1

There are 1 best solutions below

0
Jayvee On BEST ANSWER

Suppose your CYYMMDD column is called cdate and let's call the transformed date ydate then you may need a Derived Column transformation with this expression:

LEFT(cdate,1) == "0" 
? "19" + SUBSTRING(cdate,2,2) + "-" + SUBSTRING(cdate,4,2) + "-" + RIGHT(cdate,2) 
: "20" + SUBSTRING(cdate,2,2) + "-" + SUBSTRING(cdate,4,2) + "-" + RIGHT(cdate,2)

result:

enter image description here