[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 499
  • Last Modified:

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.

T1.DB1
X1   Y1   Z1

T2.DB2
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.
0
Naser Gabaj
Asked:
Naser Gabaj
2 Solutions
 
Patrick MatthewsCommented:
UPDATE Database1.dbo.SomeTable
SET SomeColumn = t2.SomeColumn
FROM Database1.dbo.SomeTable t1 INNER JOIN
      Database2.dbo.SomeTable t2 ON t1.ID = t2.ID
0
 
chapmandewCommented:
update t1
set z2 = t2.z1
from db1..t1
join db2..t2 on t1.commonfield = t2.commonfield
0
 
Naser GabajAuthor Commented:
Hi All,

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

Kind Regards,

Naser
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now