How can we increment the surrogate key value?

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
mallikharjuna
Participant
Posts: 81
Joined: Thu Nov 30, 2006 7:46 am
Location: india

How can we increment the surrogate key value?

Post by mallikharjuna »

How can we increment the surrogate key value for every insert in to target database?
MALLI
us1aslam1us
Charter Member
Charter Member
Posts: 822
Joined: Sat Sep 17, 2005 5:25 pm
Location: USA

Post by us1aslam1us »

Store the max value from the table into a hashed file. In the transformer, add this value with @OUTROWNUM for each insert.
I haven't failed, I've found 10,000 ways that don't work.
Thomas Alva Edison(1847-1931)
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Re: How can we increment the surrogate key value?

Post by ray.wurlod »

mallikharjuna wrote:How can we increment the surrogate key value for every insert in to target database?
By adding one to the previous value, which you initialize from the target table.

Or by using a sequence in the database.

There are key management routines in the SDK, but no way to initialize these out of the box - but that is possible, search the forum to find out how.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply