假设有把表TBAA中有个字段A,TABB中也有个字段A,当表TBAA更新后,我需要将字段A提取出来更新到TABB的字段A中,如何写?
我是新手,请指教!多谢

解决方案 »

  1.   

      主键关联,然后 update
      

  2.   

    create trigger tu_tbaa on tbaa
    for update
    as 
    begin
    if update(a)
    begin
    update TABB
    set a = i.a
    from inserted i,deleted d
    where i.主键 = d.主键 
    and i.a <> d.a
    and i.关联字段= TABB.关联字段
    end
    end
      

  3.   

    create trigger tu_tbaa on tbaa
    for update
    as 
    begin
    if update(a)
    begin
    update TABB
    set a = i.a
    from inserted i,deleted d
    where i.主键 = d.主键 
    and i.a <> d.a
    and i.关联字段= TABB.关联字段
    end
    end
      

  4.   

    create trigger tu_tbaa on tbaa
    for update
    as 
    begin
        if update(a)
        begin
            update TABB
            set a = i.a
            from inserted i,deleted d
            where i.主键 = d.主键 
            and i.a <> d.a
            and i.关联字段= TABB.关联字段
        end
    end
      

  5.   

    假如TABA中有个字段B,当字段A发生变化时候,我需要修改字段B的值,这又如何实现?
    请楼上兄弟指教!