Keeping orphans when a parent is deleted

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"
 
E

Earl

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?
 
K

Kevin Yu [MSFT]

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."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top