Page 1 of 1

Surrogate Key generation

Posted: Tue Apr 25, 2006 3:58 pm
by dwandbi
Once a surrogate key is generated on an out row for a column, is this keeps on increasing even if we delete all data and reload.

Is there any way if we can generate from starting number after deleting all data from target table?

thanks,
tom

Posted: Tue Apr 25, 2006 4:04 pm
by amsh76
You can always reset the value of your key. So you can set any value you want, you can go back to one as well.

Simplest thing to do, is to have a process, which will find out the Max value of ID column. This value then in turn can be used to reset the SK.

IHTH.

Posted: Tue Apr 25, 2006 4:32 pm
by ray.wurlod
How, exactly, are you generating the value? The mechanism for resetting the sequence will differ depending on your answer.

Of course, if it's a surrogate key the actual value is irrelevant; all a surrogate key provides is uniqueness.

How can this be done

Posted: Wed Apr 26, 2006 5:45 am
by dwandbi
How to reset SK value?

thanks,
Tom

Posted: Wed Apr 26, 2006 5:55 am
by chulett
As noted, depends on how it is being generated.

Still Doubt

Posted: Wed Apr 26, 2006 5:59 am
by dwandbi
I am generating using KeyMgtGetNextValue(%Sequence Name%).
So if I delete all rows in target table, and run with source data. How to reset SK ID to start from id=1.

thanks,
Tom

Posted: Wed Apr 26, 2006 6:06 am
by chulett
Search is your friend! :wink: I got 13 hits when searching for all words and 'reset KeyMgtGetNextValue'. Many of them have the actual reset syntax in them.

Posted: Wed Apr 26, 2006 8:06 am
by gateleys
You can use the UPDATE SDKSequences directly in the Administrator command, or get its content via a hashed file with 2 columns (SequenceName as key and NextValue). Then perform the update in Transformer against the Sequence Name.

gateleys