Search code examples
datessisssis-2016derived-columnssis-2017

Convert mmddyy to YYYY-MM-DD in expression task in SSIS


I'm trying to use the below code to convert data from

'010118' to '2018-01-01'

(DT_DATE)(RIGHT(DATE,2) + LEFT(DATE,2) + SUBSTRING(DATE,3,2))

When I run this in SSIS i'm getting conversion error

An error occurred while attempting to perform a type cast.

Any help is much appreciated. Thanks


Solution

  • Found a solution for this using the below code

    "20" + RIGHT(DATE,2) + "-" + LEFT(DATE,2) + "-" + SUBSTRING(DATE,3,2)