Scrpting to genrate surrogate keys

This is the code iam using to get the incremental surrogate keys:

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
'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 = 1093
End Sub

'This method gets called for each row in the InputBuffer
Public Overrides Sub Input_ProcessInputRow(ByVal Row As InputBuffer)
'Increment the variable
counter += 1

'Output the value of the variable
Row.instance = counter
End Sub

End Class

--'Instance' is my surrogate feild name

but iam getting an error saying thatInputBuffer is not defined ..Any idea?
If I want to add two more incrementive fileds ,where i have to add it?

Sorry if it sounds silly ,iam very new to this scripting.

Thanks
Niru

[1136 byte] By [Niru] at [2007-12-20]
# 1

When you first open the script the ProcessInputRow method will be defined for you. InputBuffer if is a generated class, so depending on what you called your input this can change. The default name for the input is "Input 0", so the default name for the buffer class is "Input0Buffer". In the VSA editor, look in the project explore for a file BufferWrapper, this should be your generated buffer class. What is it called? Used that name.

If you want to add more fields, first go into the Inputs and Outputs page of the transformation editor, select the output you want, expand to columns, then click Add Column.

Now when you go back to the script editor, the new column should be a property of the buffer, e.g. Row.NewColumn

If you just need simple incrementing key values, custom seed and increment, then try this- http://www.sqlis.com/default.aspx?93

DarrenSQLIS at 2007-9-9 > top of Msdn Tech,SQL Server,SQL Server Integration Services...
# 2
If you just need simple incrementing key values, custom seed and increment, then try this- http://www.sqlis.com/default.aspx?93
--
Thanks Darren.

yaa,Actually iam looking for simple incrementing key vlaues only ..but how to get that row number transmition..I checked it in the "choose items" also .Can you pls tell how to find it

Niru at 2007-9-9 > top of Msdn Tech,SQL Server,SQL Server Integration Services...
# 3
Download the installer, run it. Then go to Choose Items and select it.
DarrenSQLIS at 2007-9-9 > top of Msdn Tech,SQL Server,SQL Server Integration Services...
# 4
I have to transfer this package to someother system later ...so this will go automatically with the package or those people has to download this again seperatley to run the package without errros

Thanks
Niru

Niru at 2007-9-9 > top of Msdn Tech,SQL Server,SQL Server Integration Services...
# 5

This needs to be installed on any machine you wish to run the package on. It extends what you get out of the box, and in the same way you need to install SSIS to give you the stock components on a machine, any additional components will also need to be installed.

DarrenSQLIS at 2007-9-9 > top of Msdn Tech,SQL Server,SQL Server Integration Services...
# 6
Thanks Darren for the confirmation...Row Count is working fine ,

Trying for the Script component too.

Thanks
Kumar

Niru at 2007-9-9 > top of Msdn Tech,SQL Server,SQL Server Integration Services...

SQL Server

Site Classified