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

Connection to a server using Select

Status
Not open for further replies.

ab1011

Programmer
Feb 3, 2001
2
US
Connected to SQL SERVER 2000 - A through Query Analyzer. Is there a way in the Select Statment to connect to server B from Server A? Thanks..
 
Use the four-part naming convention:

servername.databasename.owner.table

I believe you might have to create the servers as linked servers.

Refer to the Books OnLine for linked servers.

-SQLBill
 
You need to create a Linked Server on Server A to Server B.
Its under Security in EM (Enterprise Manager).

Or if you want the T-SQL way:
EXEC sp_addlinkedserver SERVER_B, N'SQL Server'
EXEC sp_configure 'remote access', 1
RECONFIGURE
GO
exec sp_serveroption @server='SERVER_B', @optname='data access', @optvalue='TRUE'
go


Then you can query as follows:
select * from SERVER_B.DATABASE.OWNER.TABLE

Keep in mind you have to be an SA to set this up.

Let me know if it works out.

Mike


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top