SQL Query Problem

dawho9
dawho9 used Ask the Experts™
on
So I just need to do a quick restore of one column from my restore database to my production database.  Thought I was close but I guess I wasn't.  Here is what I'm trying:

USE ABC_ALL
UPDATE tblMembers
SET groupMembership = [dbo].[ABC_Restore].[tblMembers].[groupMembership]
FROM tblMembers INNER JOIN [dbo].[ABC_Restore].[tblMembers]
ON AddressID = [dbo].[ABC_Restore].[tblMembers].[AddressID]

Also tried:

UPDATE tblMembers
SET groupMembership= [dbo].[ABC_Restore].[tblMembers].[groupMembership]
WHERE AddressID = [dbo].[ABC_Restore].[tblMembers].[AddressID]

Figured one of them would have worked.

But instead of love I get:

Msg 208, Level 16, State 1, Line 1
Invalid object name 'dbo.ABC_Restore.tblMembers'.

It's got to be something really simple easy.

dw9
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Database Consultant
Top Expert 2009
Commented:
replace [dbo].[ABC_Restore].[tblMembers]   with  

[ABC_Restore].dbo.[tblMembers]
AneeshDatabase Consultant
Top Expert 2009

Commented:
DatabaseName. SchemaName.TbleName

Author

Commented:
OK, extra points now I guess.  So this:

USE ABC_ALL
UPDATE tblMembers
SET groupMembership = [ABC_Restore].[dbo].[tblMembers].[groupMembership]
FROM [ABC_ALL].[dbo].[tblMembers] A INNER JOIN [ABC_Restore].[dbo].[tblMembers]
ON A.AddressID = [ABC_Restore].[dbo].[tblMembers].[AddressID]

executes fine but doesn't update anything?  Does this look right?  Basically, have a restore of a database and need to update the production side.

Thoughts.

Author

Commented:
Got it.  For those who might need this in the future.  Trying to update one table from another table in another table.

Thanks all!

USE GCM_ALL
UPDATE tblMembers
SET [signature] = R.[signature]
FROM [ABC_ALL].[dbo].[tblMembers] A JOIN [ABC_Restore].[dbo].[tblMembers] R
ON A.AddressID = R.[AddressID]

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial