Monday, March 12, 2012

Run query with IP address

Xref: TK2MSFTNGP08.phx.gbl microsoft.public.sqlserver.programming:509038
Hi
I want to run a query that connects to a remote SQL server via an IP
address, something like
SELECT * FROM [10.101.10.10].server.dbo.table
I can't get it to work. I can connect with Enterprise manager to the IP,
what am I missing?
Thanks
TimTim,
Try:
- Using rowset functions
- Creating a linked server
- Assign an alias using Client Network Utility
Example:
use northwind
go
select top 1
*
from
OPENDATASOURCE('SQLOLEDB', 'Network Library=DBMSSOCN;Data
Source=190.162.0.11,1433;Integrated Security=SSPI').pubs.dbo.authors
go
AMB
"Tim Cowan" wrote:

> Hi
> I want to run a query that connects to a remote SQL server via an IP
> address, something like
> SELECT * FROM [10.101.10.10].server.dbo.table
> I can't get it to work. I can connect with Enterprise manager to the IP,
> what am I missing?
> Thanks
> Tim
>
>|||When you use this syntax, SQL-Server will search in the list of linked
servers for a data source named "10.101.10.10". So if you create this
linked server (with this name), then the query could work.
Gert-Jan
Tim Cowan wrote:
> Hi
> I want to run a query that connects to a remote SQL server via an IP
> address, something like
> SELECT * FROM [10.101.10.10].server.dbo.table
> I can't get it to work. I can connect with Enterprise manager to the IP,
> what am I missing?
> Thanks
> Tim

No comments:

Post a Comment