Reputation: 81
In SSIS - How can I split data from row into 2 rows for example :
FROM :
ID Data
1 On/Off
2 On/Off
TO :
ID Data
1 On
1 Off
2 On
2 Off
Upvotes: 4
Views: 1397
Reputation: 37368
You have to use a script component to achieve this. Use an unsynchronous output buffer to generate multiple rows from on row based on your own logic.
DataFlow Task
add a Flat File Source
, Script Component
, and a DestinationID
, Data
columns as InputInput and Outputs
page, click on the Output and change the Synchronous Input
property to none
ID
and Data
into the Output
Visual Basic
Inside the Script editor write the following code
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
Dim strValues() as String = Row.Data.Split(CChar("/")
For each str as String in strValues
Output0Buffer.AddRow()
Output0Buffer.ID = Row.ID
Output0Buffer.Data = str
Next
End Sub
For more details follow these links:
Based on your comments, this is a link that contains a n example of how this can be done using a SQL command
Upvotes: 1