第二步,编写备份用的触发器,只要更新大概是拔出的时分才触发
以下是援用片断为例:
altertriggertest3_bak_insert_update
ontest3
forinsert,update
as
declare@idint
declare@unamevarchar(20)
declare@uageint
begin
select@id=id,@uname=uname,@uage=uagefrominserted
if@id0
begin
updatetest3_baksetactive=0wherebid=@id
insertintotest3_bak(bid,uname,uage,active)
values(@id,@uname,@uage,1)
end
end