Keymanagement

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
murali
Participant
Posts: 54
Joined: Mon Sep 12, 2005 11:38 pm

Keymanagement

Post by murali »

hi
Iam facing a problem in generating the key can any one help me



there is a value alredy for the recorddkey it is going like this 0069809 in the source file and then in the transformation logic it is mentioned as in code , but my question is when the alredy existing record in the target is updated the key value must not change and i must get the old value only (that is existing record key in the target ) and i have used stage variable but geting the same result (i.e it is generating new value)

Code: Select all

the description goes like that 
SOURCE COLUMNS |Targetcolumns -|Tranformationlogic--    
 Recordkey/Entity ID |TRAGETKEY | Generate unique valu base on entity id 
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

During transformation, reference the target to determine if the natural key has been assigned a surrogate key. If not, then assign a surrogate and treat as an insert. If the surrogate key is found, then use that and treat as an update.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Ken's response shows you the standard technique; you need to determine whether the key already exists in the target table, and on that basis make the decision whether to insert (a new row) or update (an existing row).

Life becomes marginally more complex implementing Type 2 slowly changing dimensions, since you then expire the existing row and insert its replacement (with a new surrogate key value), rather than simply updating the row.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply