当前位置: 代码迷 >> Sybase >> sybase触发器范例
  详细解决方案

sybase触发器范例

热度:2769   发布时间:2013-02-26 00:00:00.0
sybase触发器实例
create trigger trigger_allon table_afor insert,update,deleteasif not exists(select * from deleted) and exists(select * from inserted)---插入begin	insert into table_middle (id,kind,time) select id1,'I',getDate() from insertedendelse if exists(select * from deleted) and not exists(select * from inserted)---删除begin	insert into table_middle (id,kind,time) select id1,'D',getDate() from deletedendelse if exists(select * from deleted) and exists(select * from inserted)---更新begin	insert into table_middle (id,kind,time) select id1,'U',getDate()  from insertedend