Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Update a column with data from another table

Author  Topic 

misterzr
Starting Member

49 Posts

Posted - 2005-06-16 : 17:31:24
I am trying to update data in one column with data from another column in another database. The SQL looks right but will not run. I get an error near INNER

This is the query I am trying to run

dbo and PRODDTA are the owners of the 2 databases

UPDATE dbo.F4101BUMAY24 INNER JOIN PRODDTA.F4102BUMAY27 ON dbo.F4101BUMAY24.IMLITM = PRODDTA.F4102BUMAY27.IBLITM
SET dbo.F4101BUMAY24.IMAITM = PRODDTA.F4102BUMAY27.IBAITM

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-06-16 : 17:37:26
UPDATE f1
SET IMAITM = f2.IBAITM
FROM dbo.F4101BUMAY24 f1
INNER JOIN PRODDTA.dbo.F4102BUMAY27 f2
ON f1.IMLITM = f2.IBLITM

For more information, check out UPDATE in SQL Server Books Online.

Use aliases to make your queries more readable.

Tara
Go to Top of Page

Thrasymachus
Constraint Violating Yak Guru

483 Posts

Posted - 2005-06-16 : 17:38:33
looks can be decieving

UPDATE dbo.F4101BUMAY24 SET dbo.F4101BUMAY24.IMAITM = PRODDTA.F4102BUMAY27.IBAITM
FROM dbo.F4101BUMAY24 INNER JOIN PRODDTA.F4102BUMAY27 ON dbo.F4101BUMAY24.IMLITM = PRODDTA.F4102BUMAY27.IBLITM


Sean Roussy

Please backup all of your databases including master, msdb and model on a regular basis. I am tired of telling people they are screwed. The job you save may be your own.
Go to Top of Page

misterzr
Starting Member

49 Posts

Posted - 2005-06-16 : 18:19:54
Thanks for the help this works great
Go to Top of Page
   

- Advertisement -