December 4, 2007 at 4:15 am
How can I get the number of columns in an input flat file and store this in a variable so that I can then do a conditional split?
December 4, 2007 at 4:57 am
I think the best way is to use Script Component data flow transformation (with script type set to transformation).
0. create variable ColumnsNumber,
1. put this component od the Data Flow tab surface,
2. add path from flat file source to it,
3. double click on this component,
4. select all all input columns for this component
5. add ColumnsNumber variable to list ReadWriteVariables,
6. inside script add this code (in ScriptMain method):
Dim i As Integer = Me.GetColumnIndexes(Me.ComponentMetaData.InputCollection(0).ID).Length()
Dts.Variables("ColumnsNumber").Value = i
7. this variable as you want...
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply