UPDATE A SET myCol=B.myCol
FROM myTable A
INNER JOIN myOtherTable B ON A.ID=B.ID
If you want to update the table of one database with the value of another table of another database,Use the below query.
Nothing is different from the above query with just prefix with the database name
UPDATE A SET myCol=B.myCol
FROM myDatabase.dbo.myTable A
INNER JOIN myOtherDatabase.dbo.myOtherTable B ON A.ID=B.ID
No comments:
Post a Comment