Query on surrogate keys

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
jonamg
Participant
Posts: 10
Joined: Wed Feb 23, 2005 11:29 am

Query on surrogate keys

Post by jonamg »

hi,
help in the below query
How do we use surrogate keys? Is it possible to use two surrogate keys in same server job? if possible will it be correct or give errors?
thank you
jonam
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

In the SDK included with DataStage there is a function called KeyMgtGetNextValue. It updates a hash file called SDKSequences. You need to put the current max surrogate key in this hash file. Most use a job that has a parameter for table and key name.

select max(#KeyName#) from #TableName#;

This is output into hash file SDKSequences with the TableName as the key. This fails when you have more than one surrogate key in a table. So we changed it to use KeyName as the key value in the hash file. The routine will not have to be changed only the job.
Mamu Kim
Post Reply