UPDATE record in one database with values from another in SQL Server 2008?

后端 未结 1 1263
暖寄归人
暖寄归人 2021-02-01 19:45

I need to update my new database with data from 1 column in my old database. Basically based on matching ItemID\'s I need to set the Description column in my new DB with the va

相关标签:
1条回答
  • 2021-02-01 20:37
    BEGIN TRANSACTION
    
    UPDATE t1
    SET    Description = t2.Description
    FROM   db1.dbo.foo t1
           JOIN db2.dbo.foo t2
             ON t1.ItemID = t2.ItemID
    
    SELECT * FROM db1.dbo.foo
    --prevents changes from being committed
    ROLLBACK
    
    0 讨论(0)
提交回复
热议问题