Delete Rows from target table

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
hema177
Participant
Posts: 19
Joined: Fri Apr 07, 2006 12:29 pm
Location: Edinburgh

Delete Rows from target table

Post by hema177 »

Hi,

Is there any way in which rows which no longer exist in the Source tables can be deleted from the target tables using logic inherent to Datastage?

We are running server jobs on the Datastage Enterprise 7.5.1.A edition.

Thanks,
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Sure you can, it is quite easy. One easy way (but not necessarily the fastest for huge data volumes): Do a lookup from the target to the source; if the lookup is not successful then output to a stage which deletes those rows from the target.
hema177
Participant
Posts: 19
Joined: Fri Apr 07, 2006 12:29 pm
Location: Edinburgh

Post by hema177 »

ArndW wrote:Sure you can, it is quite easy. One easy way (but not necessarily the fastest for huge data volumes): Do a lookup from the target to the source; if the lookup is not successful then output to a stage which deletes those rows from the target.
Thanks for this... Will try this out.
keshav0307
Premium Member
Premium Member
Posts: 783
Joined: Mon Jan 16, 2006 10:17 pm
Location: Sydney, Australia

Post by keshav0307 »

You can use change capture stage.
rasi
Participant
Posts: 464
Joined: Fri Oct 25, 2002 1:33 am
Location: Australia, Sydney

Post by rasi »

Change capture is in Enterprise.

Why not re-create the Target table instead of deleting. You can use bulk loader to load the target again.
Regards
Siva

Listening to the Learned

"The most precious wealth is the wealth acquired by the ear Indeed, of all wealth that wealth is the crown." - Thirukural By Thiruvalluvar
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

To find the records which are not in Source, you need to do a look, it can be either through Lookup Stage or Join stage as Arnd saind or recreate a table thorough a query INSERT INTO ....(SELECT ... FROM <target> IN(SELECT ... FROM <source>)) as suggested by Siva.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
hema177
Participant
Posts: 19
Joined: Fri Apr 07, 2006 12:29 pm
Location: Edinburgh

Post by hema177 »

Hi All,

Thanks for all the suggestions, we have had to redesign all the maps to run in Enterprise, so we'll be using the Change Capture stage to deal with the deletes.

Cheers..
Post Reply