表:  A  ,B  C   三个字段,
   
 当A,B同时改变的时候 把B的值赋值给 C   
 如果只有B变化,A 不变的话,不触发

解决方案 »

  1.   

    CREATE TRIGGER TRI_UP ON TB FOR UPDATE AS 
      BEGIN 
           IF UPDATE(A) AND UPDATE(B)
     ..
    END
      

  2.   


    if update(A) and update(B)
      

  3.   

    create trigger tr on tb
    for update
    as
    begin
    if update(a) and update(b) then
    update tb c=b from tb,deleted d where tb.a=d.a and tb.b = d.b
    end
      

  4.   

    create trigger f on tb
    for update
    as
    begin
        if update(a) and update(b) 
            update tb c=b from tb,deleted d where tb.a=d.a and tb.b = d.b
    end
      

  5.   

    http://blog.csdn.net/fredrickhu/archive/2009/10/21/4708906.aspx楼主看看
      

  6.   

    --假设a,b字段都为int型,如果类型不对,自己更改
    create trigger my_trig on tb for update
    as
    begin
      declare @a1 as int
      declare @a2 as int
      declare @b1 as int
      declare @b2 as int
      select @a1 = a , @b1 = b from deleted
      select @a2 = a , @b2 = b from inserted
      if @a1 <> @a2 and @b1 <> @b2 
         --这两句,自己选一句,看哪个合适?
         update tb set c = @b2 where 关键字 = (select 关键字 from inserted)
         update tb set c = @b2 where a = @a2 and b = @b2
    end
    go