This article is a mirror article of machine translation, please click here to jump to the original article.

View: 13532|Reply: 0

[Source] Let's talk about the role of SQL triggers and when they are used

[Copy link]
Posted on 10/9/2014 10:15:42 AM | | |
Triggers are a special type of stored procedure that is not directly invoked by the user, and it automatically takes effect when the data in the specified table changes, waking up the trigger in response to an INSERT, UPDATE, or DELETE statement.
The main benefit of triggers is that they can contain complex processing logic using Transact-SQL code. Therefore, triggers can support all the functions of constraints; But it is not always the best approach in terms of the features given. Triggers can also evaluate the state of the table before and after data modifications and take action based on the differences.

Because triggers are executed automatically, when there are abnormalities in the table of SQL operations, there will be various unpredictable exceptions, and it is difficult to achieve complex business logic processing.




Previous:Why use stored procedures in sql, and what are the advantages?
Next:sql creates stored procedures with parameters
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com