SSIS - Add new data rows


I am using SQL Server Business Intelligence Development Studio 2005 and I have the following problem:

I have a dataset, consisting of different attributes. If one attribute value consists exactly of the String "string1/string2", the string must be splitted into "string1" and "string2".  The splitted "string2" has to be added as a new row in the same table and schould keep the same values for the others attributes as "string1/string2".

How can I realize this issue?

Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

vdr1620Connect With a Mentor Commented:
You can add a derived column and check if the string is of that pattern using a FINDString Function and then map them Accordingly in your destination

In the derived Column you can use the below expression

Expr 1:
FINDSTRING(ColumnName,"/",1)>0 ? SUBSTRING(ColumnName,1,FINDSTRING(ColumnName,"/",1)-1) : ColumnName

Expr 2:
FINDSTRING(ColumnName,"/",1)>0 ? SUBSTRING(ColumnName,FINDSTRING(ColumnName,"/",1)+1,LEN(ColumnName)) : ''

Expr1 will have the String1 value and Exp2 will have String 2 value, if the pattern is string1/string2 ..Else Expr 1 will have string Value and Expr2 will have Null Value..You can map these two to the destination columns

You can also use Conditional split to search for the pattern and Split, then use derived column to process the data that meets the criteria or else directly send them to destination
Reza RadCommented:
tell us more about your package?
what is input columns and what is output columns exactly?
also samples of inputs and output....

Reza RadCommented:
this is obvious that you should use Script Component Asynchronously, because you should load data first and make output rows as you want,
this is my article about asynchronous script component:

and also you should use Split function in script task to split input value based on ( / ) character,
string[] inputarray=Row.InputCol.Split("/");

and then loop through this inputarray and add new rows.

but for detailed help, and exact code for your problem, you should provide information I requested in first post.

All Courses

From novice to tech pro — start learning today.