Description: Execute a piece of SQL when inserting, modifying, and deleting
Basic knowledge, not much to say, on the code! !
grammar:
(create)
create trigger trigger name_trigger
on 表名 for insert/update/delete
as
sql statement
go
Little plum: how to get the piece of code just inserted
create trigger insert_trigger
on student for insert
as
select * from inserted --Note : The red area is the system temporary table, which can only be queried after the trigger is executed
go
I forgot if the chestnuts are accurate or not. . . . . But the table can be found! ! !