Derived Column - Splitting
I am importing a flatfile with a column named "userid" (varchar50) into SSIS.
Examples of this column:
AN-898915
BST-924858-019
834187
818843
Y-98231708
VW-9112-39
TU-289438
What I want to do is take whatever is to the left of the first hyphen and put it into a new column called "Facility". If there is no hyphen, then it should put "XYZ" into the facility column. I could write a VB or C# script with a split to do
this, but I wasn't sure how to do it with SSIS's expressions.
January 25th, 2011 4:56pm
Hello,
Here you go
FINDSTRING([Column 0],"-",1) > 1 ? SUBSTRING([Column 0],1,FINDSTRING([Column 0],"-",1) - 1) : "XYZ"
Please replace [Column 0] with your column name in Derived Column transforamtion.
Thanks
Free Windows Admin Tool Kit Click here and download it now
January 25th, 2011 5:30pm