Page 1 of 1

Doubt regarding surrogate key.

Posted: Wed May 10, 2006 5:37 am
by rishabh
Hi everyone,

I am working on Datastage 7.5.1 server version running on Unix with DB2 database.DS Client is on windows XP.

When i use the inbuilt fuction KeyMgtGetNextValue(%dummy%) in order to generate a surrogate key, it works fine.For example for 5 records the last key generated is 5.

However when i run the job again, the next key that is generated is 6 onwards and it does not reset the value and assign the key value 1.

I would like to know how will i be able to reset the value of the surrogate key in the memory.Is there some function which would help me in this regard?

Thanks in advance.
Cheers!

Posted: Wed May 10, 2006 6:13 am
by balajisr

Posted: Wed May 10, 2006 6:44 am
by chulett
If you want it to start from 1 each time, there's absolutely no reason to use that function. Why not simply use @INROWNUM for the surrogate?

Re: Doubt regarding surrogate key.

Posted: Thu May 11, 2006 9:34 am
by raoraghunandan
rishabh wrote:Hi everyone,

I am working on Datastage 7.5.1 server version running on Unix with DB2 database.DS Client is on windows XP.

When i use the inbuilt fuction KeyMgtGetNextValue(%dummy%) in order to generate a surrogate key, it works fine.For example for 5 records the last key generated is 5.

However when i run the job again, the next key that is generated is 6 onwards and it does not reset the value and assign the key value 1.

I would like to know how will i be able to reset the value of the surrogate key in the memory.Is there some function which would help me in this regard?

Thanks in advance.
Cheers!
Can I ask, why you need to worry about the surrogate key values ? What is the problem if the surrogate key value is not reset to 1 ?

Thanks,
Raghu

Re: Doubt regarding surrogate key.

Posted: Thu May 11, 2006 2:00 pm
by gateleys
I don't see any reason why you would need to reset your surrogate key. But, if you are using it more like a sequence, then follow Craig's suggestion with @INROWNUM. If, you still feel the need to reset it, do a search on "UPDATE SDKSequences".

gateleys