建立一个触发器,当一个表中的字段被修改时,同时也将另一个表中相应字段也进行更改。

解决方案 »

  1.   

    首先两个表必须有关联关系,设table1,table2通过id关联create trigger trg_tab_upt on table1
    for update
    as 
    update a set a.字段=b.字段 from table2 a join inserted b on a.id=b.id where a.字段!=b.字段
      

  2.   

    给楼主几个触发器的例子供参考:
    http://community.csdn.net/Expert/topic/5634/5634833.xml?temp=.6377527
    http://community.csdn.net/Expert/topic/5635/5635058.xml?temp=.5518457
    http://community.csdn.net/Expert/topic/5636/5636068.xml?temp=.687649