Split a single column of comma-delimited data into multiple columns in SSIS

I have a table in SQL Server with three columns, one of which is a data column containing rows of concatenated columns separated by commas. The first row is also the title bar of the new table I want to create. so basically I want to do this.

Data      | ID | Source 
====================
a,b,c,d,e | 1  | a.csv

f,g,h,i,j | 2  | b.csv

in

a | b | c | d | e
=================
f | g | h | i | j

Using SSIS, the only way I could do this was to use a dump in the text file of the data column and then re-read it as a flat file source, but I would prefer to avoid creating unnecessary unnecessary files

EDIT: Sorry, I'm using SSIS 2008

+4
source share
2 answers

, . script.

, script. script , (InputColumn1). ( , , 5, 5 (OutputColumn1 - 5)).

script (#).

:

public override void Input0_ProcessInputRow(Input0Buffer Row)
{
}

:

var ColumnValue = Row.InputColumn1.Split(',');

Row.OutputColumn1 = ColumnValue[0];
Row.OutputColumn2 = ColumnValue[1];
Row.OutputColumn3 = ColumnValue[2];
Row.OutputColumn4 = ColumnValue[3];
Row.OutputColumn5 = ColumnValue[4];

script , OutputCoulmns1-5, , .

 Data      | ID | Source |OutputColumn1 |OutputColumn2|  etc. 3-5
 ================================================================
 a,b,c,d,e | 1  | a.csv  |  a           |  b

 f,g,h,i,j | 2  | b.csv  |  f           |  g

, , -.

+4

Token, , , .

derived column transformation - :

([Name_of_your_Column], "," , 1)

"a"

TOKEN ([Name_of_your_Column], "," , 2)

"b"

script component. "DATA" , . split, .

string [] myNewColumns = inputColumn.split( "," );

+3

All Articles