Anyone know the syntax and function to get SSIS to populate a derived column with a self incrementing index? I'm using the Derived Column tool but can't find an index or rowcount/rownumber function.
Thanks.
'The world isn't round - it's bent!' Spike Milligan
Answered my own question.
Use the Script object and define it as transforming. Make the script look like this.
Public Class ScriptMain
Inherits UserComponent
'Declare a variable scoped to class ScriptMain
Dim counter As Integer
Public Sub New() ' This method gets called only once per execution
'Initialise the variable
counter = 0
End Sub
'This method gets called for each row in the InputBuffer
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
'
' Increment the variable
'
counter += 1
' Output the value of the variable
Row.Index = counter
End Sub
'The world isn't round - it's bent!' Spike Milligan
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.