就是A,B表中数据同步
用B来更新A
一个pk 
一个待更新column..麻烦写出详细的语句
谢谢

解决方案 »

  1.   

    update A
    set
        [column]=B.[column]
    from 
        B
    where 
        B.PK=A.PK
      

  2.   

    表A(id,colOld)
    表B(id,colNew)
    update 表A set colOld=(select colNew from 表B where id=表A.id)
      

  3.   

    update A set 字段名=B.字段名 from A inner join  B on A.PK=B.PK
      

  4.   

    使用cursor的方法
    ---------------------------------------------------------------------
    为什么要用游标?一条SQL语句可以解决的问题不值当。
    满足一下楼主的好奇心,使用游标的实现方式;
    注意:假设两个字段都为int类型,楼主根据具体的情况来更改即可:
    declare @pk int,@column intdeclare t_cursor cursor for select [pk],[column] from Bopen t_cursorfetch next from t_cursor into @pk,@columnwhile @@fetch_status=0
    begin
        update A set [column]=@column where [pk]=@pk
        fetch next from t_cursor into @pk,@column
    endclose t_cursor
    deallocate t_cursor
      

  5.   

    用cursor然后fetch。。
    赫赫