DML trigger plan guide

Source: Internet
Author: User

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:

  • Constraint Processing

Alternative:

  • Trigger operation

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.