Page 1 of 1

KeyMgtGetNextValue - Surrogate Key Generation

Posted: Thu Sep 15, 2005 12:24 am
by anupam
Hi All,

I am planning to use KeyMgtGetNextValue for generation of Surrogate Key in multiple Jobs simultaneously.

I want every Job to start the sequence number from 1 and then keep on incrementing. Can it be done using KeyMgtGetNextValue.

What is the best possible way to generate surrogate key in Server mode in multiple different Jobs simultaneously.

Posted: Thu Sep 15, 2005 1:12 am
by WoMaWil
each key has a name. If you want to fill different keys you have to use different names. If you want to feed from the same sequence use same name.

Wolfgang

Posted: Thu Sep 15, 2005 1:27 am
by anupam
I have different Jobs ( J1 and J2)

And in each of the Jobs i want surrogate keys starting from 1 and getting incremented.

Posted: Thu Sep 15, 2005 1:37 am
by wnogalski
For generating surrogate keys from one sequence simultaneously use KeyMgtGetNextValueConcurrent().

Posted: Thu Sep 15, 2005 1:38 am
by anupam
I want to start the Sequence Number from 1 in each case.

Posted: Thu Sep 15, 2005 2:14 am
by ray.wurlod
Then you may need to reset the sequence name(s) in a before-stage subroutine. Search the forum for "SDKSequences".

Posted: Thu Sep 15, 2005 3:18 am
by sandy
The sequences start with 1 and go on incrementing for each sequence name argument specified to this routine.
For Eg: KeyMgtGetNextValue('X') will start from 1 and so will KeyMgtGetNextValue('Y'). Then onwards each sequence shall go on incrementing by 1 for each call made to them. If you want to reset the sequence value you can use an UPDATE statement as below

UPDATE SDKSequences USING DICT VOC SET F1 = 'New Value' WHERE @ID = 'Name of the sequence';

Hope this helps.

Posted: Thu Sep 15, 2005 5:57 am
by chulett
anupam wrote:I want to start the Sequence Number from 1 in each case.
Then it doesn't necessarily sound like you even need a Sequence number generator. Are you saying that you need to start them at 1 each time the job is run? If that's the case you could just use @INROWNUM.

Posted: Thu Sep 15, 2005 6:06 am
by anupam
Thanks all for the Expert advice, Issue is resolved.

Posted: Thu Sep 15, 2005 6:11 am
by rumu
anupam wrote:Thanks all for the Expert advice, Issue is resolved.
Hi Anupam,
Can you please be specific how does yor problem get solved?Have u using update command to set SDK sequence or using @INROWNUM?