Is a ''-'' (minus sign) valid in a linked server name.

  • I'm trying to pull data from a SQL 2000 server to a SQL 2005 server using a linked server.

    I added the linked server via a right click on the linked server option.

    The server created without a problem, but when I query it with:

    select * from openquery(my-database,'select * from FIS..vw_Employee')

    I get this error:

    Msg 102, Level 15, State 1, Line 5

    Incorrect syntax near '-'.

    I've tried escaping the '-' with \,\\,/, // single and double quotes.

    Is a minus sign valid in a server name?

    This will move to DTS at a later date, but I thought this would be a simple, quick fix.

    Thanks,

    Scott

  • Yes, this will work.  What you need is to wrap brackets around the linked name.

    select

    * from openquery([my-server],'select * from FIS..vw_Employee')

    -- Cory

  • That works.

    Thanks

    Scott

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply