架构师_程序员_码农网

Retrieve password
Register

QQ登录

Just one step to get started

Search
View:8601|Reply: 0
打印 上一主题 下一主题

[Information]Introduction to the role of sql triggers, in what circumstances the use of triggers

[Copy Link]
跳转到指定楼层
owner of the building
发表于 2014-10-9 10:15:42| 看该作者回帖奖励|Browse in reverse order|Read mode
Triggers are used in situations where you want various additions, deletions, and changes to data to be handled immediately. They are a special type of stored procedure that is not called directly by the user, and it takes effect automatically when the data in the specified table changes, waking up to call 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. As a result, triggers can support all of the functionality of constraints; however, it is not always the best approach for the given functionality. Triggers can also evaluate the state of a table before and after data modifications and take countermeasures based on the differences.

Since triggers are automatically executed, so when the table operated by sql has an exception, there will be all kinds of unpredictable exceptions, and it is difficult to realize complex business logic processing, so in large application systems generally do not use triggers, but use stored procedures or middleware to unify the processing of data.




Previous: sql why use stored procedures, what are the advantages?
Next article: sql create stored procedure with parameters
code farmer network, only published in the practice process, encountered technical difficulties, not mislead others.
You need to log in before you can post back Log in | Register

This version of the integral rules

DISCLAIMER:
All software, programming materials or articles published by Code Farmer are only used for learning and research purposes; the above content shall not be used for commercial or illegal purposes, otherwise, all the consequences should be borne by the user. This site information from the network, copyright dispute has nothing to do with this site. You must completely remove the above content from your computer within 24 hours of downloading. If you like the program, please support the genuine software, buy registration and get better genuine service. If there is any infringement, please contact us by email to deal with it.

Mail To:help@itsvse.com

QQ| ( ICP备14021824号-2 )|Sitemap

GMT+8, 2024-9-17 12:22

Quick ReplyBack to topBack to list