Update one table from another table in the same SQL Server

I have two Tables with the same name, in two differrent database on the same MS-SQL Server 2000, and I wanted to update one colomn in one table from the other database.

X1   Y1   Z1

X2   Y2   Z2

So, the Query should looks like
Update Z2 from Z1.

I hope I make it clear for you guys, please let me know.
LVL 15
Naser GabajE&P Senior Software SpecialistAsked:
Who is Participating?
Patrick MatthewsConnect With a Mentor Commented:
UPDATE Database1.dbo.SomeTable
SET SomeColumn = t2.SomeColumn
FROM Database1.dbo.SomeTable t1 INNER JOIN
      Database2.dbo.SomeTable t2 ON t1.ID = t2.ID
chapmandewConnect With a Mentor Commented:
update t1
set z2 = t2.z1
from db1..t1
join db2..t2 on t1.commonfield = t2.commonfield
Naser GabajE&P Senior Software SpecialistAuthor Commented:
Hi All,

Thank you Guys for your instant answer, and I apologize for being late to reply to you.

Kind Regards,

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.