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
 Import/Export (DTS) and Replication (2000)
 Insert Into from One server to another

Author  Topic 

Funkabubble
Starting Member

3 Posts

Posted - 2002-07-15 : 07:28:54
Hi all,

Background : I need to copy records from one database on server A to a database on Server B. Only particular records are required. Both servers are SQL 6.5. The structure of the databases are identical. Server B is just an archive.

Currently I am attempting to use the sql statement :
insert into mcd2.dbo.quotes_sys (MILEAGE,SURNAME)
select MILEAGE,SURNAME
from mcd.dbo.quotes_sys
where surname = x

However, while this works from one database to another on server A, I can't get it to connect accross the servers. I imagine would be like this:
insert into MCDPDC2.mcd2.dbo.quotes_sys (MILEAGE,SURNAME)
select MILEAGE,SURNAME
from SAN02.mcd.dbo.quotes_sys
where surname = x

This comes up with an error saying "contains more than the maximum number of prefixes. The maximum is 2."

Apparently I need to set up a linked server in order to do this? can any one tell me how to do this or perhaps do you have any other ideas of how to do it?

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-07-15 : 09:39:08
You do need to set up linked server. I'm guessing that in the time between when you posted this question and now, you have looked up Linked Server in Books Online and resolved the issue ...

<edit>Oops, Linked Servers didn't exist in 6.5,sorry</edit>

<O>

Edited by - Page47 on 07/15/2002 10:01:33
Go to Top of Page

Nazim
A custom title

1408 Posts

Posted - 2002-07-15 : 10:14:50
you can use OPERNROWSET

eg:
SELECT a.*
FROM OPENROWSET('SQLOLEDB','seattle1';'sa';'MyPass',
'SELECT * FROM pubs.dbo.authors ORDER BY au_lname, au_fname') AS a




-------------------------
What lies behind you and what lies ahead of you are small matters compared to what lies within you.-Ralph Waldo Emerson
Go to Top of Page
   

- Advertisement -