Need help with Derived Column Transformation - string to numeric
Hi,
My flat file source has a column defined as string and I need to convert it to a number (13,2).
The first 177 rows has spaces for this field (" ", then numbers will appear starting with row 178. I tried to create a new column using the following:
TRIM(SPNDWN_AMT) == "0 " ? NULL(DT_NUMERIC,13,2) : (DT_NUMERIC,13,2)(TRIM(SPNDWN_AMT))
This errors out with:[Convert SpendDown Amt to Numeric [782]] Error: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "component "Convert SpendDown Amt to Numeric" (782)" failed because error code 0xC0049063 occurred, and the error row disposition
on "output column "SPNDWN_AMT_REV" (793)" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure.
What am I doing wrong?
Thanks for your help.
Dave
October 12th, 2012 6:08am
Use this expression
ISNULL(SPNDWN_AMT)? NULL(DT_NUMERIC,13,2) : (TRIM(SPNDWN_AMT) == "" ? NULL(DT_NUMERIC,13,2) : (DT_NUMERIC,13,2)(TRIM(SPNDWN_AMT)))
http://btsbee.wordpress.com/
Free Windows Admin Tool Kit Click here and download it now
October 12th, 2012 6:13am
Hi Dave,
This?
TRIM(SPNDWN_AMT) == "" ? NULL(DT_NUMERIC,13,2) : (DT_NUMERIC,13,2)(TRIM(SPNDWN_AMT))
Rajkumar
October 12th, 2012 6:14am
Thanks btsbee for your help.
Rajkumar: thanks also for helping me.
Dave
Free Windows Admin Tool Kit Click here and download it now
October 12th, 2012 7:38am