Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create SQL Statements that use Multiple Servers

Status
Not open for further replies.

JulesDBQ

Programmer
Apr 17, 2003
22
US
I would like to create stored procedures that produce results based on data contained on two completely separate SQL Servers. I am administrator of the first server, so I have full rights to it...but, I am only a reader of the data on the second server - so I have no control of it.

I need to reference both of these servers to get the results I am looking for. I have poked around to see how this happens, but am unclear. I saw some information about linked servers...but I don't know if I will be able to do this, since I don't have rights to the second server.

Any assistance would be much appreciated. Thanks in advance!
 
If you don't want to set up linked server you can use OPENROWSET, look it up in BOL
example

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


then you can join that result to your table

Denis The SQL Menace
SQL blog:
Personal Blog:
 
As long as you have admin rights to the first server then you can setup a linked server to the second server.

Denny
MCSA (2003) / MCDBA (SQL 2000) / MCTS (SQL 2005)

--Anything is possible. All it takes is a little research. (Me)
[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top