CREATE TRIGGER trigger_update_表1 ON 表1  
   FOR UPDATE AS  
      BEGIN 
        if exists(select * from sysobjects where name = '表2') 
           begin
             insert into 表2(pz) select pz from inserted 
           end 
      END   CREATE TRIGGER trigger_insert_表1 ON 表1  
   FOR INSERT AS  
      BEGIN 
        if exists(select * from sysobjects where name = '表2') 
           begin
             insert into 表2(pz) select pz from inserted 
           end 
      END ========================
大概是这样的语法,没有验证过。

解决方案 »

  1.   

    在SQL SERVER 数据库中,选择要建立触发器的表,右键,在菜单中选择“所有任务”->“管理触发器”,就可以了,然后输入触发器要实现的代码。
      

  2.   

    如楼顶的所说,还有一种情况
    create trigger trigger_delete on a
    for delete as 
    begin
    '加入语句'
    end
      

  3.   

    create trigger trigger_delete on a
    for delete as 
    begin
      declare @aaa varchar(10);
      select @aaa=aaa from table /*aaa为表中的字段*/
      update table 
    end
      

  4.   

    create trigger On_INSERT on aTAB
    INSTEAD OF INSERT as 
    begin
       .
       .
       .
    end