Groups | Blog | Home
all groups > inetserver asp db > november 2005 >

inetserver asp db : delete related records


polilop
11/21/2005 12:00:00 AM
In my database i have a table that contains topics and it is related to
another table which contains subtopics. What i have to do is delete a record
in the topics but i allso have to delete the related records in the sub
topics (as they are related). Is there a easier way to do this then having
to first delete the subtopics and then delete the topics records?

Mighty Chaffinch
11/21/2005 12:00:00 AM
[quoted text, click to view]

Use foreign keys to enforce referential integrity, if your DBMS supports
this.

Bob Lehmann
11/21/2005 5:53:01 PM
Set up the relationships to do Cascading Deletes. But, be careful.

Bob Lehmann

[quoted text, click to view]

polilop
11/21/2005 9:05:18 PM
They use foreign keys to enforce referential integrity, thats why i cannot
delete a record from table topics if it has a record in the table subtopic ,
becouse subtopic contains the foreign key topics. But what i have to do is
delete a record from topics table and allso if it has a subtopic, delete it
allso. Is there a way to delete them both without having to delete the
record from the subtopic and then delete the related topic record???



[quoted text, click to view]

AddThis Social Bookmark Button