Click here to Skip to main content
15,889,034 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to collect data from one database(DB1) in a remote server(Server1) to another database(DB2) that is also in another remote server(Server2).

I got 2 suggestions : using openrowset , and linked server
Posted

Openrowset is performance impact option. use linked server. sp_addlinkedserver will help you to add the link server and you can proceed the servername before DB.TableName in the query

SQL
select * into server1.DB1.dbo.Targettable from server2.DB2.dbo.SourceTable
 
Share this answer
 
v2
Comments
Member 11312264 9-Apr-15 4:08am    
Thank you sir
I have executed sp_addlinkedserver and sp_addlinkedsrvlogin
then i executed the query but got a error message:

OLE DB provider "SQLNCLI" for linked server "xxxx" returned message "Login timeout expired".
OLE DB provider "SQLNCLI" for linked server "xxxx" returned message "An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.".
Msg 2, Level 16, State 1, Line 0
Named Pipes Provider: Could not open a connection to SQL Server [2].
The issue is because TCP/IP is not enabled on the remote server.

http://www.mssqltips.com/sqlservertip/2340/resolving-could-not-open-a-connection-to-sql-server-errors/[^]

Try the above steps to resolve this issue.
 
Share this answer
 
v2
Comments
Member 11312264 10-Apr-15 3:36am    
Thank You Sir.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900