INSTEAD OF DELETE Triggers

Creating and Maintaining Databases

Creating and Maintaining Databases

INSTEAD OF DELETE Triggers

INSTEAD OF DELETE triggers can be defined on a view or table to replace the standard action of the DELETE statement. Usually, the INSTEAD OF DELETE trigger is defined on a view to modify data in one or more base tables.

DELETE statements do not specify modifications to existing data values. DELETE statements specify only the rows that are to be deleted. The inserted table passed to a DELETE trigger is always empty. The deleted table sent to a DELETE trigger contains an image of the rows as they existed before the UPDATE statement was issued. In the case of an INSTEAD OF DELETE trigger on a view or table, the format of the deleted table is based on the format of the select list defined for the view.

Note  INSTEAD OF DELETE triggers cannot be defined on a table that has a foreign key defined with a DELETE action.