Selecting from a Linked Server

  • Hi,

    For testing purposes I've setup a Linked Server from a production server to my own Windows XP

    Pc which is running SQL 2005 developer edition.

    Linked server is setup with a type of 'SQL Server' and the instance has a name of 'PC001\PC001'.

    By expanding the linked server catalogue I can see the databases etc but I can't seem to query the

    database using T-SQL becuase of the backslash in the instance name.

    e.g.

    select * from [PC001\PC001].mydatabase.dbo.mytable

    Msg 7202, Level 11, State 2, Line 1

    Could not find server 'PC001\PC001' in sys.servers. Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers.

    Tried it without the square brackets, same result.

    Any ideas?

    Dave

  • Have you queried sys.servers for PC001\PC001? With and without the brackets. If you set up the linked server using the Microsoft OLE DB PRovider for SQL Server you can name it whatever you want so you could call it MyPC and this would eliminate the need for the brackets.

  • There have been no further changes abd it works fine now, can't explain that.

    Cheers

    Dave

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

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