Wednesday, January 6, 2010

Conversion of String (12012009) to date in SSIS

Use the following expression for converting string to date, here date is maintained like string.

Ex: suppose date : 2009-12-01 is maintained like '12012009'

Expression :

For suppose your column name is d_record_end_date then you need to use the following expression to convert string to date format. We need to use this expression in derived column, it will create a new column of type DATE.

(DT_date)(SUBSTRING(d_record_end_date,5,4) + "-" + SUBSTRING(d_record_end_date,1,2) + "-" + SUBSTRING(d_record_end_date,3,2))

No comments:

Post a Comment