Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UPDATE WITH INNER JOIN BETWEEN DATABASES 2

Status
Not open for further replies.

jcg6

Technical User
Feb 18, 2002
50
US
I want to update a table in one database, based on an INNER JOIN with a table in another database. I can do this in Access, but SQL is having problems with my syntax. Can anyone point me in the right direction??

The error message I receive is..

Server: Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'INNER'.

Here is my statement:

UPDATE Licensed_PCs INNER JOIN [HardwareDB].[dbo].[Hardware]
ON Licensed_PCs.MachineID = [HardwareDB].[dbo].[Hardware].[MachineID]
SET Licensed_PCs.ActualDepartment = [HardwareDB].[dbo].[Hardware].[Department]

Thanks in advance. :)
 
UPDATE Licensed_PCs

SET Licensed_PCs.ActualDepartment = [HardwareDB].[dbo].[Hardware].[Department]

FROM Licensed_PCs
INNER JOIN [HardwareDB].[dbo].[Hardware]
ON Licensed_PCs.MachineID = [HardwareDB].[dbo].[Hardware].[MachineID]

-Karl
 
Thanks donutman....you saved me tons of time!! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top