Solved

SSIS - Add new data rows

Posted on 2010-08-30
3
639 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Comparison of Amazon Drive, Google Drive, OneDrive

What is Best for Backup: Amazon Drive, Google Drive or MS OneDrive? In this free whitepaper we look at their performance, pricing, and platform availability to help you decide which cloud drive is right for your situation. Download and read the results of our testing for free!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
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.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

705 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