• I would create a package level (or scope it to the data flow) variable of type int and set to zero. The code in the Script Transformation will use the Input0_ProcessInputRow procedure to increment your variable and your Identity Column. Something like this should do the trick:

    Option Strict Off

    Imports System

    Imports System.Data

    Imports System.Math

    Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper

    Imports Microsoft.SqlServer.Dts.Runtime.Wrapper

    Public Class ScriptMain

    Inherits UserComponent

    Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)

    MyBase.Input0_ProcessInputRow(Row)

    Dim vars As IDTSVariables90

    Dim Count As Integer

    Me.VariableDispenser.LockOneForRead("PipelineRows", vars)

    Count = vars(0).Value

    vars.Unlock()

    Me.VariableDispenser.LockOneForWrite("PipelineRows", vars)

    vars(0).Value = Count + 1

    Row.Ident = Count + 1

    vars.Unlock()

    End Sub

    End Class

    Keep in mind that you'll want to set your identity column (Ident in my exampe) to ReadWrite on the Input Columns page of the Script Transformation editor.

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden