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!

Linked Server IP Query

Status
Not open for further replies.

Delphin

Programmer
Nov 27, 2001
134
US
I am trying to query a linked server and the the only properties I have is the IP address which is linked directly to the DB I have access to.

I have tried a query such as select [10.10.10.10].* from 10.10.10.10.tbl1

I know this is incorrect, but the server is linkeddirect to the DB which doesn't come up.
 
You'll need the database name of the database you are trying to get data out of. Querying data from a linked server requires the use of the full four part name.
Code:
[{ServerName}].[{database}].[{owner}].[{table}]
In this case (based on what you've provided) you'd need something like this.
Code:
select *
from [10.10.10.10].{database}.dbo.tbl1

Linked servers aren't linked directly to databases. They are linked to servers. From a linked server you can access any database on the server. When you select tables in the linked server the database that shows up is simply the default database for the account that is making the link.

To view a list of databases on the remote server try this query.
Code:
select name
from [10.10.10.10].master.dbo.sysdatabases


Denny

--Anything is possible. All it takes is a little research. (Me)

[noevil]
(My very old site)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top