Generate Sequence

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
c341
Participant
Posts: 39
Joined: Mon Jan 26, 2004 8:43 pm

Generate Sequence

Post by c341 »

Hi
I'm using @INROWNUM and @OUTROWNUM ...for generating surrogate keys....
When i see the data for the first time the sequence starts from 1 and increments by 1.....
when i run the job again by clearing the existing records...the sequence strats from where it ends.....
Now i need this sequence to strat again from 1.....
Is there any way not using this system variables and generat Sequence numbers....
Thank You
c341
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There are lots of ways.

Search this site for terms like "surrogate key", "slowly changing dimension" and "sequence" to learn about some of them.

Ultimately you have to capture your start point from the target table and increment from there.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: Generate Sequence

Post by chulett »

c341 wrote:When i see the data for the first time the sequence starts from 1 and increments by 1.....
when i run the job again by clearing the existing records...the sequence strats from where it ends.....
Now i need this sequence to strat again from 1.....
This is confusing to me. If you need a Sequence to start over from 1 each time, that is the behaviour you'll get when using @INROWNUM or @OUTROWNUM as the sequence generator. You seem to be saying that you are using them and yet somehow the "Sequence" is automatically picking from where it left off in the previous run. :? This is not possible.

As Ray mentions, there are ways to do this - but using @IN/OUTROWNUM is not one of them.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply