Cascading Delete

Results 1 to 2 of 2

Thread: Cascading Delete

  1. #1
    Join Date
    Dec 1969

    Default Cascading Delete

    Hi,<BR>I need to delete data from a table which is referenced by several others. Obviously I need to get rid of the data in the referencing tables first, but these are referenced by other tables, and so on.<BR><BR>Is there an easy way to delete all the data &#039from the bottom up&#039, or am i going to be writing a lot of SQL?<BR><BR>Cheers in advance

  2. #2 Guest

    Default What DBMS?

    In access you can setup relationships to enforces referential integrity, including casscading deltes and updates. If you define such relationships, all you need to do is delete frm the master table and all related rows are deleted. However you have to be very carefull with both your DB design and your coding to be sure that you insert rows in the right order (eg when adding rows you woul need to make sure there is a row in the master table before you can add children). <BR><BR>In my opinion, it is easier and you have more control by coding these rules. It is a little more work, but safer. Besides if you forget to delete child rows explicitly it is easy enough to run periodic cleanups to remove orphaned rows. In the meantime the orphaned rows need not be a problem if they are never accessed.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts