Requirement: need to have a sequence number for Primary key in Dimension table along with surrogate key. Basically Sql Server does not allow two IDENTITY columns, i try to create sequence number by using script component, code seems correct but encountering errors while passing new records through script component in Dataflow (using script component for trasformation).
Created a user Variable to get the maximum sequence number from that dimension and script component should create sequence numbers from maximum number onwards
user::wellFacID data type Int32
Column: FacIdCount data type numeric(9,0), tried with DT_I4
encountering bellow error when package runs. if you are familier with bellow error, please post your responses, thanks
[Script Component [1169]] Error: System.Runtime.InteropServices.COMException (0xC0010009): Exception from HRESULT: 0xC0010009 at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.HandleUserException(Exception e) at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.ProcessInput(Int32 inputID, PipelineBuffer buffer) at Microsoft.SqlServer.Dts.Pipeline.ManagedComponentHost.HostProcessInput(IDTSManagedComponentWrapper90 wrapper, Int32 inputID, IDTSBuffer90 pDTSBuffer, IntPtr bufferWirePacket)
' Microsoft SQL Server Integration Services user script component
' This is your new script component in Microsoft Visual Basic .NET
' ScriptMain is the entrypoint class for script components
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts
Imports Microsoft.SqlServer.Dts.Runtime
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
Imports Microsoft.SqlServer.Dts.Runtime.Wrapper
Public Class ScriptMain
Inherits UserComponent
Dim rowcounter As Integer = 0
Dim RowString As String
Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)
'rowcounter = CType(Me.ReadOnlyVariables("User::WellFacID").Value, Integer)
RowString = Me.ReadOnlyVariables("User::WellFacID").Value.ToString
rowcounter = CType(RowString, Integer)
rowcounter = rowcounter + 1
Row.FacIdCount = rowcounter
End Sub
End Class