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

后端 未结 3 1637
孤街浪徒
孤街浪徒 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 05:59

    Data:

    |                    COMPANY |
    |----------------------------|
    |   Virgin Altantic - F30008 |
    |            Google - F38115 |
    | Google youtube - F38115169 |
    

    Derived Column Code:

    NewColumn1

    SUBSTRING(Company,1,LEN(Company) - FINDSTRING(REVERSE(Company),"-",1) - 1)
    

    NewColumn2

    SUBSTRING(Company,LEN(Company) - FINDSTRING(REVERSE(Company),"-",1) + 3,FINDSTRING(REVERSE(Company),"-",1) - 2)
    

    Result:

    enter image description here

提交回复
热议问题