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?
infutechAsked:
Who is Participating?
 
ShogunWadeCommented:
try this:

select * from OPENQUERY([66.240.29.197],'select * from XMCTStatus.dbo.tblTZ')
0
 
ShogunWadeCommented:
what is the name of your linked server?


select * from OPENQUERY(MyLinkedServerName,'select * from XMCTStatus.dbo.tblTZ')
0
 
infutechAuthor Commented:
The name is 66.240.29.197.  
0
 
infutechAuthor Commented:
Worked like a charm! Thanks.
0
 
ShogunWadeCommented:
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  [ ]
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.