Reputation: 21
I am extracting pattern from the 'Notes' column, I am looking for an alpha numeric word (MXPC123456) from the notes and I want to store the output in a new column. So for that I am using a Derived Column
and FindString()
function.
I am getting error when I run this code using the following expression in Drived Column
inside my SSIS
package:
(DT_WSTR,255)SUBSTRING(TEXT_LINE1,FINDSTRING(TEXT_LINE1,"MXPC",1),10).
Don't know what I am doing wrong.
Error: 0xC0049067 at Get DC Coms Data, Derived Column [67]: An error occurred while evaluating the function.
Error: 0xC0209029 at Get DC Coms Data, Derived Column [67]: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "component "Derived Column" (67)" failed because error code 0xC0049067 occurred, and the error row disposition on "output column "CKT_MX" (91)" 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.
Error: 0xC0047022 at Get DC Coms Data, SSIS.Pipeline: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Derived Column" (67) failed with error code 0xC0209029 while processing input "Derived Column Input" (68). The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information about the failure.
Could you please help?
Regards Prab
Upvotes: 1
Views: 5055
Reputation: 37368
There are 2 things that may cause this error:
TEXT_LINE1
doesn't contains "MXPC"
string , so FINDSTRING(TEXT_LINE1,"MXPC",1)
will return 0
and the SUBSTRING
function will throw an exceptionTEXT_LINE1
contains "MXPC"
string but there is no 10 characters after the FINDSTRING
returned valueTEXT_LINE1
IS NULLso you can add some validation to this expression
ISNULL([TEXT_LINE1]) == TRUE ? "" : (FINDSTRING([TEXT_LINE1],"MXPC",1) == 0 ? "" :
(LEN([TEXT_LINE1]) >= FINDSTRING([TEXT_LINE1],"MXPC",1) + 9 ? SUBSTRING([TEXT_LINE1],FINDSTRING([TEXT_LINE1],"MXPC",1),10) : ""))
Upvotes: 1