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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy data from one database to another

Status
Not open for further replies.
Jan 23, 2002
63
0
0
US
Hi,

I screwed up the data in one field in a database, but I had just done a backup prior (ain't THAT dumb!). Anyway, I restored the backup to a RESTOREDB database on the same server, now I want to UPDATE the original table with the restored values for that field, linked by the identity ID field. I don't see why this statement is failing, but I get an error that the multipart identifier RESTOREDB.dbo.Applications.ApplicationName could not be bound.

I've tried putting brackets [] around the DB name and field, with no luck. This is MS SQL 2008. Anybody have any ideas, please?

update Servers.dbo.Applications
set servers.dbo.applications.ApplicationName=RESTOREDB.dbo.Applications.ApplicationName
where servers.dbo.applications.ApplicationID=RESTOREDB.dbo.Applications.ApplicationID
 
Code:
update Applications
       set ApplicationName = RSTDB.ApplicationName
FROM Servers.dbo.Applications Applications
INNER JOIN RESTOREDB.dbo.Applications RSTDB 
      ON applications.ApplicationID=RSTDB.ApplicationID

Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top