SSIS expression

2019-07-13 01:55发布

问题:

Anybody have any idea why this SSIS expression is not working

The derived column name is from_service_date_yyyymmdd

The expression is

(DT_STR,4,1252)from_service_date_yyyy + RIGHT("0" + (DT_STR,2,1252)from_service_date_mm,2) + RIGHT("0" + (DT_STR,2,1252)from_service_date_dd,2)

from_service_date_yyyy, from_service_date_mm and from_service_date_dd all have valid values

The output from the derived column transformation does not have from_service_date_yyyymmdd. I can't figure out why.

回答1:

your expression looks fine, but you missed the brackets in the columns names, and you have to cast columns to DT_WSTR instead of DT_STR because RIGHT() function result is of type DT_WSTR, and cast the whole result to DT_DTR if needed

(DT_WSTR,8,1252)((DT_WSTR,4)[from_service_date_yyyy] + RIGHT("0" + 
(DT_WSTR,2)[from_service_date_mm],2) + RIGHT("0" + 
(DT_WSTR,2)[from_service_date_dd],2))