Straight from the MSDN archives, I found this little gem to count rows within a data pipe as they are processed. The key phrase is: “as they are processed”. You’d think the Row Count transformation would work if you wanted a sequential row number. Unfortunately, this transformation only updates the assigned variable at the end of processing for the given Data Flow task.
As a lover of code snippets for reuse, here’s what you have to do:
1. Add an Output Column. I called mine rowCount.
2. Add the following script lines:
Public Class ScriptMain
Dim iCount As Integer = 0
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
Row.rowCount = iCount
iCount = iCount + 1