sql 触发器
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
更正如上