ITeye博客

sql 触发器

freellf · 2012-04-22 23:34 · 数据库 · Markdown

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

更正如上

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。