I have a source column, KEY2 that I need to perform some string manipulation on within the Derived Column transformation within SSIS. It's configured as the following
KEY2
Replace 'KEY2'
(FINDSTRING(KEY,",",1) - 2) > 0 ?
SUBSTRING(KEY,FINDSTRING(KEY,",",1) + 2,LEN(KEY) - FINDSTRING(KEY,",",1) - 1) : ""
string [DT_STR]
1
1252 (ANSI - Latin I)
The length is 1. I need to change it to 100. I have tried this:
(DT_STR,100)(FINDSTRING(KEY,",",1) - 2) > 0 ?
SUBSTRING(KEY,FINDSTRING(KEY,",",1) + 2,LEN(KEY) - FINDSTRING(KEY,",",1) - 1) : ""
However, I am prompted with a parse error. What is the problem?
Update
I have followed markTheLiars' answer. The expression now looks like this:
KEY2 Replace 'KEY2' (DT_STR,100,1252)((FINDSTRING(KEY,",",1) - 2) > 0 ?
SUBSTRING(KEY,FINDSTRING(KEY,",",1) + 2,LEN(KEY) - FINDSTRING(KEY,",",1) - 1) : "") string [DT_STR] 1 1252 (ANSI - Latin I)
The expression compiles and runs, however I am prompted with the same error as the length does not change even though there is a cast.