deleting rows from a table and then inserting rows

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
karrisuresh
Participant
Posts: 57
Joined: Sat Jun 09, 2007 1:14 am
Location: chicago

deleting rows from a table and then inserting rows

Post by karrisuresh »

I have a target table say EMP table

I have to load 1000 records from a file into EMP table and say all the 1000 records coming from file have only the Dept no's 1,2,3

When my job runs,
my criteria is to delete all the existing records in the table with dept no 1,2,3
and load the fresh 1000 records into the target EMP table

thanks,
Suresh
Hi I have experience in parallel extender datastage I am ready to give/take help from other
hope we all help each other hand in hand
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Use the OPEN command to pass a delete with the where predicate that contains those ids.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
karrisuresh
Participant
Posts: 57
Joined: Sat Jun 09, 2007 1:14 am
Location: chicago

Re: deleting rows from a table and then inserting rows

Post by karrisuresh »

Could anyone elaborate on this

thanks
suresh
Hi I have experience in parallel extender datastage I am ready to give/take help from other
hope we all help each other hand in hand
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

OPEN/CLOSE commands get executed only once before or after the sql body, respectively.
Open your enterprise stage, go to the 'properties' tab. Its under 'Options Category'
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
samsuf2002
Premium Member
Premium Member
Posts: 397
Joined: Wed Apr 12, 2006 2:28 pm
Location: Tennesse

Post by samsuf2002 »

In your target stage you will option for open command (sql executes before loading the table) and close command (sql executes after loading the table), since you need to delete the those entries with id 1,2,3 before loading the table you can use open command to sql for your criteria.
hi sam here
karrisuresh
Participant
Posts: 57
Joined: Sat Jun 09, 2007 1:14 am
Location: chicago

Re: deleting rows from a table and then inserting rows

Post by karrisuresh »

Hi
I am happy to see the option "OPEN" as mentioned
but with write mode as upsert, I could not see that option

when I am trying to use write mode as "LOAD"
I am getting an error

Could you please suggest me a method only with Upsert write method
(where I will use only insert condition and put 1=2 in update condition)
and the "OPEN "command with write method as "UPSERT"

thanks
suresh
Hi I have experience in parallel extender datastage I am ready to give/take help from other
hope we all help each other hand in hand
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Can you run two jobs in succession, one with Delete, the other with Insert, using the same keys?
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