Keeping orphans when a parent is deleted

  • Thread starter Thread starter Earl
  • Start date Start date
E

Earl

I have some lookup tables that provide various information, and I give my
users the ability to do all the "crud" operations. However, while I haven't
run into this yet, I'm mulling what happens when my users delete, for
example, a "reason code", but I do not want to cascade the delete into the
child (e.g., Customer) table. Invariably, I can see this scenario popping up
in more than one occasion -- someone decides that a particular entry is no
longer required and deletes it from the parent/lookup table. The parent
records aren't totally orphaned, as they themselves may either be child or
parent records to other tables. Any general advice on how to deal with this
scenario?


"I didn't trade her in, that would denote some value; I scrapped her" --
"Cotton", referring to his ex on "King of the Hill"
 
Thanks Sahil. Am I reading it correctly that it "might" be okay to leave
orphans in the actual records where say an entry was deleted from a lookup
table?
 
Hi Earl,

I think Sahil means if there is relation set in the database, the database
will check the integrality of data. That will generate error if the entry
is deleted from a lookup table, because it breaks the foreign key
constraint.

So if you don't care about the integrality, you can simply removes the
relation in database.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top