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
Generate Sequence
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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.
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.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Re: Generate Sequence
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.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.....
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
"You can never have too many knives" -- Logan Nine Fingers