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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query to compare results from a sql server 7 from a sql server 2005

Status
Not open for further replies.

limester

Technical User
Dec 29, 2004
69
CA
I am trying to do a query comparison between a sql server v7 and a sql server 2005 and output the results in sql analyser.

The db schema is the same between both servers, they reside on different machines, but are on the same physical network and subnet.

I am not sure that sql server 7 supports 'Linked server' queries?

Any help would be greatly appreciated!

Cheers!
 
Well, if your question is how do I set up a linked server in SQL Server 2005 and how do I run a query against that linked server then the answer would be this

Add a linked server using the t-sql command sp_addlinkedserver which is documented here


Or for clarity if our server is called server1 then use

Code:
USE master;
GO
EXEC sp_addlinkedserver 
   'server1',
   N'SQL Server'
GO

Then, if there was a database on server1 called customers and you wanted to get a count from the address table you could query it like this

Code:
SELECT COUNT(*) FROM server1.dbo.address

Hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top