?
Solved

SSIS - Add new data rows

Posted on 2010-08-30
3
Medium Priority
?
641 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 2000 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

770 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