SSIS How to get part of a string by separator

前端 未结 4 1920
旧巷少年郎
旧巷少年郎 2020-12-11 01:12

I need an SSIS expression to get the left part of a string before the separator, and then put the new string in a new column. I checked in derived column, it seems no such e

4条回答
  •  清歌不尽
    2020-12-11 02:01

    You can specify the length to copy in the SUBSTRING function and check for the location of the dash using CHARINDEX

    SELECT SUBSTRING(@sString, 1, CHARINDEX('-',@sString) - 1)
    

    For the SSIS expression it is pretty much the same code:

    SUBSTRING(@[User::String], 1, FINDSTRING(@[User::String], "-", 1)-1)
    

提交回复
热议问题