In SQL Server is a certain operation on a table, triggering a certain condition, thus executing a program. A trigger is a special stored procedure.
There are three common triggers: Apply to insert, Update, Delete event, respectively.
Learn a key knowledge before you write. Two pro tables used by triggers: Deleted, Inserted.
Deleted and Inserted store the "old record" and "new record" that triggered the event table, respectively.
An update process can be thought of as: Generate a new record to the inserted table, copy the old record to the deleted table, and then delete the original table record and write the record.
As an example:
Create trigger [trigger name]
on [dbo]. [Original Table]
For delete
As
DECLARE @id int
Select @id =autoid from inserted
Delete from video_002 where
This article is from the "Shadow of War" blog, be sure to keep this source http://rmlifejun.blog.51cto.com/7683304/1543271