8.3.08

Updating table in different database in sql server

Problem Statement:
I want to update DatabaseA.TableA.Col1 with reference to Database2.TableB.Col2
with condition TableA.ColA = TableB.colB

Code Snippet

Update A set A.Col1 = B.Col2
from DatabaseA.dbo.TableA inner join Database2.dbo.TableB
on A.ColA = B.ColB

1 comment:

  1. How can we update the table from another database in another server automatically ?

    ReplyDelete