Solved

SSIS - Add new data rows

Posted on 2010-08-30
3
634 Views
Last Modified: 2013-11-10
Hello,

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?

Thanks.
0
Comment
Question by:TSYSTEMS_LOBPLM
  • 2
3 Comments
 
LVL 30

Expert Comment

by:Reza Rad
ID: 33558617
tell us more about your package?
what is input columns and what is output columns exactly?
also samples of inputs and output....

0
 
LVL 30

Expert Comment

by:Reza Rad
ID: 33558792
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:
http://www.experts-exchange.com/A_2886-How-to-use-Script-Component-as-Asynchronous-Transformation.html

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.


0
 
LVL 16

Accepted Solution

by:
vdr1620 earned 500 total points
ID: 33567389
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
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now