标签:
触发器inserted表与deleted表
create trigger tbl_TblClass_insert_after
on TblClass after insert
as
begin
declare @id int,
declare @name varchar(50),
declare @desc varchar(50)
select @id=tClassId ,@name=tclassName,@desc=ClassDesc from inserted
print @id
print @name
print @desc
end
--测试
insert into TblClass values(‘班级名称‘,‘班级描述‘)
create trigger tri_TblClass_delete_after
on TblClass after delete[,insert]
as
begin
insert into TblClass_Bak select * from deleted
end
create trriger tri_TblClass_delete_instead_of
on TblClass instead of delete
as
begin
insert into TblClassBak select * from deleted
end
--使用 instead of 触发器后,原来删除操作被 insert into TblClassBak
标签:
原文地址:http://www.cnblogs.com/wupd2014/p/4975627.html