UPDATE record in one database with values from another in SQL Server 2008?
I nee开发者_Python百科d 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 values in the old DB. I can see what needs to be updated when I do a join but I am not sure how to handle this update properly.
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
精彩评论