SSIS How to get part of a string by separator

Better late than never, but I wanted to do this too and found this.

TOKEN(character_expression, delimiter_string, occurrence)

TOKEN("a little white dog"," ",2)

returns little the source is below

http://technet.microsoft.com/en-us/library/hh213216.aspx


of course you can:

enter image description here

just configure your derived columns like this:

enter image description here

Here is the expression to make your life easier:

SUBSTRING(name,1,FINDSTRING(name,"-",1) - 1)

FYI, the second "1" means to get the first occurrence of the string "-"

EDIT: expression to deal with string without "-"

FINDSTRING(name,"-",1) != 0 ? (SUBSTRING(name,1,FINDSTRING(name,"-",1) - 1)) : name