?
Solved

Retreive Data from Remote SQL Server

Posted on 2011-05-11
5
Medium Priority
?
319 Views
Last Modified: 2012-05-11
Hi All,

We have a local SQL 2008 server and a remote SQL 2005 server at the other end of a VPN tunnel. We want to programatically retrieve data from the remote server. What is the best approach? Any experience is appreciated,
0
Comment
Question by:Primedius
5 Comments
 
LVL 5

Accepted Solution

by:
bitref earned 1000 total points
ID: 35741741
You may create a linked server on the local SQL 2008 server to reference the remote SQL 2005.
0
 
LVL 11

Assisted Solution

by:brutaldev
brutaldev earned 1000 total points
ID: 35741819
While connected to the 2008 server, create a linked server to the 2005 machine:
 
USE master;
GO
EXEC sp_addlinkedserver 
   N'My2005Server',
   N'SQL Server';
GO

Open in new window

More info: http://msdn.microsoft.com/en-us/library/ms190479.aspx

Secondly you will need to add the login information you want to use to access the server from the remote 2008 machine (more than likely necessary):
 
EXEC sp_addlinkedsrvlogin 'My2005Server', 'false', 'Domain\Mary', 'MaryP', 'd89q3w4u'

Open in new window

More info: http://msdn.microsoft.com/en-us/library/ms189811.aspx

Lastly, when you access your 2005 server you can use syntax like:
 
SELECT * FROM My2005Server.DatabaseToUse.dbo.TableToUse;

Open in new window

0
 
LVL 21

Expert Comment

by:Alpesh Patel
ID: 35745782
If in network then not an issue. but on different network then need to be on live ip and use it using link server
0
 
LVL 25

Expert Comment

by:TempDBA
ID: 35752797
you can try openrowset too but linked server is better option.
0
 

Author Closing Comment

by:Primedius
ID: 35753189
Thank you, This is what we did.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
SQL Database Recovery Software repairs the MDF & NDF Files, corrupted due to hardware related issues or software related errors. Provides preview of recovered database objects and allows saving in either MSSQL, CSV, HTML or XLS format. Ensures recov…
Stellar Phoenix SQL Database Repair software easily fixes the suspect mode issue of SQL Server database. It is a simple process to bring the database from suspect mode to normal mode. Check out the video and fix the SQL database suspect mode problem.

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question