SQLTeam.com | Weblogs | Forums

SSIS Derived Columns

Hello,

This is my first time using a Derived Columns step and am required to program some Expressions from an old DTS package that uses VB script.

Does anyone know how to convert this so that it maybe used as a Derived Column Expression?

Example: The source column 042 has 20190213 and the destination column has 2019-02-13 00:00:00.000 by using the following VB script:

IF DTSSource("Col042") > "0" THEN
DTSDestination("DestinationColumn") = Mid(DTSSource("Col042"),5,2)&"/"&Mid(DTSSource("Col042"),7,2)&"/"&left(DTSSource("Col042"),4)
ELSE DTSDestination("DestinationColumn") = NULL
END IF

I am also perplexed by what seems to be slashes is now converted to dashes.

Thank you.

1 Like

They are converting it to a date. Try this

(DT_DBDATE)(SUBSTRING(Column042,1,4) + "-" + SUBSTRING(Column042,5,2) + "-" + SUBSTRING(Column042,7,2))