reset surrogatekey

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
george s thazhath
Participant
Posts: 1
Joined: Thu Sep 14, 2006 4:45 am
Location: bangalore

reset surrogatekey

Post by george s thazhath »

i want to reset sdknextseqvalue how to do it
kindly give the way
ray.wurlod
Participant
Posts: 54595
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Welcome aboard. :D
Did you think to search the forum? This question has been asked and answered in the past.
Essentially you need to be aware that the sequence is a record in a Repository table called SDKSequences; the name of the sequence is the key to the record, and the next key value is stored in the first non-key field.
However, SDKSequences does not have a fully-defined dictionary (metadata) so that you need some indirection in your update mechanism. For example

Code: Select all

 UPDATE SDKSequences USING DICT VOC SET F1 = '1' WHERE @ID = '<<SequenceName>>';
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

We use a naming convention that the column name is the key. So CustomerID becomes the key for CustomerDim. We reseed these values right before we use them. I provided this job in EtlStats. It is called ETL_Reseed_SDKSequences. If you do a search on "reseed" then you will find other posts about this topic. This job is a multiple instance job and runs before every dimension table gets loaded with new records. It does not slow down the ETL. It can be run when the data is being extracted from the source. Besides it is extremely fast because these fields are usually the primary key. So how long does it take to run this SQL when CustomerID is the primary key.

Code: Select all

select max(CustomerID) + 1 As NextKey from CuistomerDim


Your ETL should control these hashed files. I am sure Ray has a job just like this. I also like that this forces a naming convention on the key in SDKSequences.
Mamu Kim
Post Reply