Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

SSIS Derived Column split first parentheses of characters

SSIS Derived Column split first parentheses of characters

SSIS Derived Column split first parentheses of characters

Im trying to workout how to write an expression in the derived Column task, to extract a readcode e.g (XXXX) from another column

ID | Ethnicity | ReadCode
1 | (XXXX) White British | (XXXX)

So far i have the expression

CODE -->

"(" + SUBSTRING(Ethnicity,(FINDSTRING(Ethnicity,"(",1) + 1),(FINDSTRING(Ethnicity,")",1) - 2)) 

But it throws up an error:

[Derived Column 2 [11]] Error: An error occurred while evaluating the function.

[Derived Column 2 [11]] Error: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "Derived Column 2" failed because error code 0xC0049067 occurred, and the error row disposition on "Derived Column 2.Inputs[Derived Column Input].Columns[ReadCode]" 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.

[SSIS.Pipeline] Error: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "Derived Column 2" (11) failed with error code 0xC0209029 while processing input "Derived Column Input" (12). 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.

Can anyone help?

RE: SSIS Derived Column split first parentheses of characters

2 things wrong there.

1 - it will fail if the string does not contain both ( and ) in that order - look at using the if operator before doing the string.

2 - SUBSTRING(Ethnicity,(FINDSTRING(Ethnicity,"(",1) + 1),(FINDSTRING(Ethnicity,")",1) - 2))
is incorrect. lets look at this example.
string = "XXX ( CC )" - e.g. string with 9 chars in size.
the above formula would return SUBSTRING(string, 5 + 1, 9 - 2) - this would fail as 6 , 7 results on a substring bigger than the remaining number of characters on your string.
so correct formula would be SUBSTRING(Ethnicity,(FINDSTRING(Ethnicity,"(",1) + 1),(FINDSTRING(Ethnicity,")",1) - FINDSTRING(Ethnicity,"(",1)) )) (or very near, but you should get the idea)


Frederico Fonseca
SysSoft Integrated Ltd

FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?
FAQ181-2886: How can I maximize my chances of getting an answer?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close