Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Enterprise
Expertise: Advanced
Aug 4, 2000



Full Text Search: The Key to Better Natural Language Queries for NoSQL in Node.js

Using Distributed Queries on SQL Server 7.0

SQL Sever 7.0 allows developers to execute commands against OLE DB data sources on different servers. In order to execute commands on remote servers, the SQL Server instance where the commands will be issued must be setup properly. This entails adding the remote server to SQL Server's linked server list. Do this by using the sp_addlinkedserver command.

For example, to link a remote SQL Server database that resides on the RemoteDBServer server, you would use the following syntax:

 EXEC master. . sp_addlinkedserver 
@server = 'RemoteDBServer', 
@provider = 'SQLOLEDB', 
@srvproduct = 'SQL Server',
@datasrc = 'RemoteDBServer'
Note that only members of the sysadmin role can set this server option.

Once the remote database has been linked, queries can be executed against it—as long as the remote tables are prefaced using Server.Database.Table Owner.Table Name. For example, the following query would return all rows in the authors table of our RemoteDBServer SQL Server database:

 SELECT * FROM RemoteDBServer.pubs.dbo.authors
Andrew Holliday
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date