Link to home
Start Free TrialLog in
Avatar of infutech
infutech

asked on

Linked Server Query - Trying to set up an OPENQUERY with a server that is addressed by IP

I have set up a linked server within enterprise manager. When I try to run the statement below in SQL Query Analyzer I recieve an error:
select * from OPENQUERY(66.240.29.197,'select * from XMCTStatus.dbo.tblTZ')
Error: Line 1: Incorrect syntax near '64.240'.

Can I run this against a server defined with an IP?
Avatar of ShogunWade
ShogunWade

what is the name of your linked server?


select * from OPENQUERY(MyLinkedServerName,'select * from XMCTStatus.dbo.tblTZ')
Avatar of infutech

ASKER

The name is 66.240.29.197.  
ASKER CERTIFIED SOLUTION
Avatar of ShogunWade
ShogunWade

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Worked like a charm! Thanks.
your welcome.

Basically the issue was that the linked server name in the openquery statement is defined as a sysname datatype.  sysname types containing white space or punctuation must be enclosed in  [ ]