Suppose I have tables:
Employee(empid, ....)
Phone(phoneid, ...)
EmployeePhone(empid, phoneid, ...)
a foreign key is created and cascading deletion is determined by the foreign key relationship.
Now I delete the phone from the telephone table. I want to write the deletion to the Phone table delete trigger.
But I can not get empid in the phone. After removing a trigger, for example
select empid from deleted d join EmployeePhone e on d.phoneid = e.Phoneid
because the entry in EmployeePhone was deleted using cascade delete with foreign key relationship.
How to get empid on phone after delete trigger?
source
share