dynamic delete script based on columns

From: <ralphbuetikofer_at_yahoo.de>
Date: Tue, 20 Nov 2007 03:55:09 -0800 (PST)
Message-ID: <cbc9383a-0bca-4fce-bb87-9d9140157bdb_at_e4g2000hsg.googlegroups.com>



[Quoted] hi all,

i got a big problem and hope, somebody can help. i have to create a dynamic delete script which has to run once a day. the script should find all tables containing a specific column (DEL_YN). then it should physically delete all records in this tables with value 'Y' in that column which indicates that the row has been 'deleted' by a user.

i know i can get a cursor with all table-names by the sys.all_objects joining with the sys.all_tab_columns to determine if the specific column exists in the table.
and i do know i can use this cursor to delete the records in all the tables.

what i do not know is how can i assure that the delete script runs through the tables in the right order (i.e. dependencies, constraints......)??

can anybody help?

thanks in advance!

kind regards,
bueti Received on Tue Nov 20 2007 - 12:55:09 CET

Original text of this message