不能這樣嗎?
update tableA
set field1=B.field1,field2=B.field2
from tableA,tableB B where tableA.ID=tableB.ID

解决方案 »

  1.   

    如果是字段數不确定
    那可以先組合SQL 再用exec執行我是這樣想的,不知對你有沒有幫助
      

  2.   

    字段是確定的,
    ========================
    回复人: wxxzf(小风) ( )
    不能這樣嗎?
    update tableA
    set field1=B.field1,field2=B.field2
    from tableA,tableB B where tableA.ID=tableB.ID
    ===============================
    這個返回值不正確,行不通
      

  3.   

    暈死。。我知道問題出在那了,
    B中的ID不是唯一的
    應該怎么搞呢。。
      

  4.   

    select id,count(id)
    from b
    group by id
    having count(id) > 1
    这条语句就可以找出所有重复的id加以修改后再重新更新