There are two options for designing DML triggers:
- Execute the instead trigger instead of the usual trigger operation. You can also define the instead
Triggers. These triggers can extend the update types supported by the view.
- Execute the after Trigger After executing the insert, update, or delete statement operation. The specified after is the same as the specified. After
Triggers can only be specified on tables.
The following table compares the functions of the After trigger and the instead of trigger.
| Function |
After trigger |
Instead of trigger |
Applicability |
Table |
Tables and views |
Number of triggers contained in each table or view |
Each trigger operation (Update, delete, and insert) contains multiple triggers. |
Each trigger operation (Update, delete, and insert) contains a trigger. |
Cascade references |
No restrictions |
The instead of update and delete triggers cannot be used on tables that serve as the target of cascading integrity constraints. |
Run |
Later:
- Constraint Processing
- Declarative reference operation
- CreateInsertedAndDeletedTable
- Trigger operation
|
Earlier:
Alternative:
Later:
- CreateInsertedAndDeletedTable
|
Execution sequence |
You can specify the first and last executions. |
Not applicable |
InsertedAndDeletedTableVarchar (max),Nvarchar (max)And Varbinary (max)Column reference. |
Allow |
Allow |
InsertedAndDeletedTableText,NtextAndImage Column reference. |
Not Allowed |
Allow |