how to insert unique records

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
jpraveen
Participant
Posts: 71
Joined: Sat Jun 06, 2009 7:10 am
Location: HYD

how to insert unique records

Post by jpraveen »

Hi

my reqiurement is to insert the records which are not in the Target(having Cluster Primary Key on Target table).i had 3 jobs and Target is same table,the first job will insert the distinct records(the job finished successful)while the Second job is aborted due to PK violation.

so i need to take the target table in to LOOKUP,but how the logic should be implemented that only the records which are not available in the target should be INSERTED
can u suggest some logic.

Thanks in advance
Jaypee
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Use lookup stage and use reject link from lookup stage to get the records which are not in Target table
You are the creator of your destiny - Swami Vivekananda
austin_316
Participant
Posts: 80
Joined: Fri Aug 21, 2009 7:49 am
Location: India

how to insert unique records

Post by austin_316 »

If the jobs are not executed in parallel you can take a lookup of this table and fetch the data from the table using query something like

Code: Select all

select pk1,1 as dummy from table
and forward dummy from lookup stage.
and then after the lookup you can use a transfomer or filter.
if you are using the transformer then in the link constraint give the condition as

Code: Select all

IsNULL(link.dummy) 
where insert link goes.
or if you are using filter then you can give

Code: Select all

dummy<>1

please try this and i hope it would solve your issue.
jpraveen
Participant
Posts: 71
Joined: Sat Jun 06, 2009 7:10 am
Location: HYD

Post by jpraveen »

Hi

i am running the job parallel and i want to insert the records which are not in the target table(not to use dataset we have only target table),so i use Lookup and my target as a reject link and Primary output as Peek stage.so is there any option to insert the reject records from the look up.
Jaypee
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Insert the records from reject link in to the target table
You are the creator of your destiny - Swami Vivekananda
Post Reply