Two Questions:
1. Why doesn't the following trigger work? Note that STUDENTS is the
master table and STUDCOUNSELORS and TESTS are detail tables. All three
tables have a field called FSID. In this case, there are NOT foreign keys
in the detail tables. When the STUDENT record is deleted, the detail
records from the detail tables are NOT deleted.
CREATE TRIGGER CASCADE_DELETES ON dbo.STUDENTS
FOR DELETE
AS
begin
from deleted d
delete from STUDCOUNSELORS
delete from TESTS
end
2. What is the best way to implement a cascading delete in a Master-Detail
relationship when a foreign key DOES exist in the detail tables? Trigger
or Stored Proc?
David Sweeney
Texas A&M University