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)
 Refer to a server in an Insert statement

Author  Topic 

CanadaDBA

583 Posts

Posted - 2008-06-27 : 15:31:48
I have 53 databases and they are same as each other with different data. There is a table with static data in each database. It happened that I lost the data in this table for all 53 databases. I want to restore the data from backup. I have restored all 53 dbs into a Temp server called ServerA.

I want to copy the table from Temp server into Test server, ServerB (from all 53 databases into their corresponding databases on dest server). Both servers are SQL2000.

The code below is supposed to do the work for one table and I will use a cursor to repeat but look at the code...

Truncate Table [ServerB].[DB1].[dbo].[T01]
GO
INSERT INTO [ServerB].[DB1].[dbo].[T01]
SELECT [F1], [F2], [F3] FROM [ServerA].[DB1].[dbo].[T01]


Well, I know [ServerB].[DB1].[dbo].[T01] is incorrect.. my mind has frozen this afternoon!!

Thanks,


Canada DBA

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-06-27 : 15:39:21
Duplicate.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -