SSIS How to get part of a string by separator using Derived Column

后端 未结 3 1612
孤街浪徒
孤街浪徒 2021-01-14 05:15

I trying to write an SSIS expression to get the right part of a string before the separator and then put the new string in a new column. I have used Substring and Findstring

3条回答
  •  天涯浪人
    2021-01-14 06:02

    The problem you have is that you want the end of the string and your current code is giving you the beginning of the string.

    The documentation for SUBSTRING specifies 3 parameters: expression, starting position and length. FINDSTRING is returning the position of the separator. What you are doing is specifying the start position at 1, the first character in your column.

    Instead, make that the position of the separator, plus 2 spaces to account for the separator itself and the space. The length is going to be the LEN([Company]) - FINDSTRING([Company],"- ",1)

    In all version of SSIS, we also have RIGHT which is a specialized version of SUBSTRING that you could have also used.

提交回复
热议问题