Gowtham Ramamoorthy
Gowtham Ramamoorthy

Reputation: 896

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

Upvotes: 2

Views: 273

Answers (1)

Gowtham Ramamoorthy
Gowtham Ramamoorthy

Reputation: 896

Found a solution for this using the below code

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

Upvotes: 2

Related Questions