if exists (select 1
from sysobjects
where id = object_id('T_accountingsubject')
and type = 'TR')
drop trigger T_accountingsubject
go
create trigger T_accountingsubject on 表名
for/after/instead of insert
as
begin
if exists(select 1 from inserted) and not exists(select 1 from deleted)
begin
update accountingsubjects set isend=0 where id in(select parentid from inserted)
end
end
go
if exists (select 1
from sysobjects
where id = object_id('T_accountingsubject')
and type = 'TR')
drop trigger T_accountingsubject
go
create trigger T_accountingsubject on 表名
for/after/instead of insert
as
if exists(select 1 from inserted) and not exists(select 1 from deleted)
begin
update accountingsubjects set isend=0 where id in(select parentid from inserted)
end
go
更正如上
sql 触发器
猜你喜欢
转载自freellf.iteye.com/blog/1494093
今日推荐
周排行