In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
A trigger is a special type of stored procedure, which is different from the general stored procedure described earlier.
The general stored procedure is called directly through the name of the stored procedure, while the trigger is mainly triggered by the event.
Triggers are a powerful tool that is automatically enforced when data changes in a table.
Triggers can be used to check the integrity of SQL Server constraints, default values, and rules
You can also perform complex functions that are difficult to implement with ordinary constraints.
What on earth is a trigger?
In SQL Server, that is, a certain operation on a table, triggering a certain condition, and thus the execution of a program.
A trigger is a special stored procedure.
There are three common triggers: applied to Insert, Update, and Delete events
Common grammar
CREATE TRIGGER triggerName ON TableName
For UPDATE | INSERT | DELETE
AS
Begin
Select * from updated
-- inserted
-- deleted
End
Create trigger tem on employees for delete
As
Begin
Declare @ num int
Select @ num=count (*) from deleted
If @ num > 2
Print 'delete a maximum of 2 entries at a time'
Rollback transaction
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.