hi to all, I need a trigger that deletes records from a table when they are deleted from another table. The records to be deleted were inserted into user table by copying the table where I want to control lines erased. In summary: I have a table of detailed records and when a registration is deleted need to be deleted the same record in another table that contains the same records but summarized. Already grateful.
You can create a trigger on the detailed records table. In the trigger code, you will have access to the rows that were deleted via the DELETED virtual table. You can examine that table and decide how to update/delete rows from the summary table.
One thing to keep in mind is that the DELETED virtual table can have more than one row. This comes about because the trigger gets called once for each delete operation regardless of the number of rows affected by the delete action.