Sequences

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
tmcnicol
Premium Member
Premium Member
Posts: 4
Joined: Tue Jan 23, 2007 1:01 pm
Location: HCL

Sequences

Post by tmcnicol »

I am familiar with the sequence function in the server environment, is this done using the surrogate key generator stage, and if so, is the last number used saved somewhere or does is have to be derived at the beginning of job where the sequence is needed?
zam62
Participant
Posts: 42
Joined: Tue Apr 29, 2003 12:21 pm

Re: Sequences

Post by zam62 »

tmcnicol wrote:I am familiar with the sequence function in the server environment, is this done using the surrogate key generator stage, and if so, is the last number used saved somewhere or does is have to be derived at the beginning of job where the sequence is needed?
The Surrogate Key generator has a 'start value' property under the keys. What you would need to do is get the desired starting value and pass it in as a job parameter, or have a lookup stage to get that value and add it to the Surrogate Key generated in a TX stage following the SK stage.
IE...
do A lookup to get the max val from the table you wish to load and store that in a field being passed to the KEY_GEN stage. Then in the following TX stage, add that value to the generated value from the KEY_GEN stage and store that in the column that you want to be the key.
HAVE A GOOD ONE
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Welcome Aboard 8)
It has to be derived and fed to the surrogate key generator as a parameter. Click herefor a recent discussion on this topic.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply