Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I insert a sequence id into a table

Status
Not open for further replies.

garpale

Technical User
Feb 10, 2004
2
0
0
IT
During a transformation I need to insert a unique identifier into a column of the destination table.

Everytime I insert a new record, I need to generate a unique code. How can I do it?

I tried to use the DTSLookups function, but I've got this error:

Error Source: Microsoft Data Transformation Services (DTS) Data Pump
Error Description:Error Code: 0
Error Source= Microsoft VBScript runtime error
Error Description: Invalid procedure call or argument: 'DTSSource'


The activeX script was:

Function Main()
DTSDestination("ORACLE_HOME_ID") = DTSLookups("my_query").Execute(DTSSource("ORACLE_HOME"))
Main = DTSTransformStat_OK
End Function

And the query was:

SELECT 1 + ISNULL(MAX(col_ID), 0)
FROM destination_table
 
Can you create an Identity column in your destination table?? This way you can insert your records and have the identity column increment automatically and thus will create a unqiue ID for each insertion.

Thanks

J. Kusch
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top