copying data from one server to another

Hi all

I am trying to copy data from one database server to another. I only
want to copy one table's data, not the entire database. The part that
I am having trouble with is connecting from one database server and
connect to another then telling it to insert into the second database
server.

Not sure if this is how it works.

any help is appreciated.
thanks
Harold
Guineapig1980 [ Di, 22 April 2008 15:11 ] [ ID #1947605 ]

Re: copying data from one server to another

You can add linked server and use it to copy the table data across server.
Creating linked server is done using sp_addlinkedserver:

EXEC sp_addlinkedserver 'RemoteServer', N'SQL Server'

Based on security settings you may need to map remote server logins. This is
done using sp_addlinkedsrvlogin:

EXEC sp_addlinkedsrvlogin 'RemoteServer', 'false', 'LocalUser',
'RemoteUser', 'RemotePassword'

Then you just run a normal query referencing the linked server table with 4
part name:

INSERT INTO TargetTable
SELECT <columns>
FROM RemoteServer.RemoteDB.dbo.RemoteTable

HTH,

Plamen Ratchev
http://www.SQLStudio.com
Plamen Ratchev [ Di, 22 April 2008 15:49 ] [ ID #1947606 ]
Datenbanken » comp.databases.ms-sqlserver » copying data from one server to another

Vorheriges Thema: Basic SQL Question
Nächstes Thema: Re: Using findstr on SQL 2005 ERRORLOG file