Solved

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

Posted on 2004-10-28
291 Views
Last Modified: 2006-11-17
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?
0
Question by:infutech
    5 Comments
     
    LVL 18

    Expert Comment

    by:ShogunWade
    what is the name of your linked server?


    select * from OPENQUERY(MyLinkedServerName,'select * from XMCTStatus.dbo.tblTZ')
    0
     

    Author Comment

    by:infutech
    The name is 66.240.29.197.  
    0
     
    LVL 18

    Accepted Solution

    by:
    try this:

    select * from OPENQUERY([66.240.29.197],'select * from XMCTStatus.dbo.tblTZ')
    0
     

    Author Comment

    by:infutech
    Worked like a charm! Thanks.
    0
     
    LVL 18

    Expert Comment

    by:ShogunWade
    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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT Security CISA, CISSP & CISM Certification

    Master the advanced techniques required to protect network resources from external threats with the IT Cyber Security bundle. Built around industry best-practice guidelines, the IT Cyber Security bundle consists of three in-depth courses.

    This is my first ever Article on EE or elsewhere; therefore, please bear with me if I have some discrepancies in my writing. I read many articles and questions related to "how to pass values to SSIS packages at run-time?"  Hence, this common ques…
    In this article—a derivative of my DaytaBase.org blog post (http://daytabase.org/2011/06/18/what-week-is-it/)—I will explore a few different perspectives on which week today's date falls within using Microsoft SQL Server. First, to frame this stu…
    Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
    Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

    913 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now