使用触发器试试,应该能很好完成同步效果
给你写个框架 希望采纳!
- create TRIGGER 触发器名ON 表名for insert,update,delete AS BEGINif exists(select 1 from inserted) and not exists(select 1 from deleted) begin--插入操作end else if exists(select 1 from inserted) and exists(select 1 from deleted)--update触发器 begin --更新操作 end else if not exists(select 1 from inserted) and exists(select 1 from deleted)--delete触发器 begin--删除操作 endENDgo
复制代码 |