SQL Trigger (Trigger)

Source: Internet
Author: User

1. A special stored procedure that is automatically executed when a trigger inserts, updates, or deletes a table.

2. Triggers are generally used for more complex constraints on check constraints.

3. The difference between a trigger and a normal stored procedure is that the trigger is when a table is manipulated.

4.update, INSERT, delete these operations, the system will automatically call the execution of the corresponding trigger on the table.

5. A trigger (trigger) is a special stored procedure whose execution is not invoked by the program or manually, but is triggered by an event that activates it when the operation is performed on a table (Insert,delete, update). Triggers are often used to enforce data integrity constraints and business rules, etc.

--Create TRIGGER trigger Mytrigger01 on table_1for Insert--insert trigger, Update,deleteas   INSERT INTO Table_3 ( Materialname,mtype)   Select top 1 materialname,mtype from table_1 the ORDER by id desc  print ' Insert trigger executed successfully. '  --execute INSERT trigger takes effect  insert into table_1 values (' Vivopad ', 2)

  

SQL Trigger (Trigger)

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.