Link to other server using sp_addlinkedserver RRS feed

  • Question

  • Dear All,

                   i'm new to linked server... i just got some sample and tryed this.. but i get below error message, all the credital information are correct..

    EXEC sp_addlinkedserver
       @server = 'sampledb951',
       @srvproduct = '',
       @provider = 'SQLNCLI',
       @provstr = 'DRIVER={SQL Server};SERVER=;UID=sa;PWD=admin123;',
       @catalog = 'sampledb'

    the above executes fine... but error comes when i execute the below line

    Msg 7313, Level 16, State 1, Line 1
    An invalid schema or catalog was specified for the provider "SQLNCLI" for linked server "sampledb951".

    SELECT * FROM sampledb951...fo_rsrvtn_hdr

    fo_rsrvtn_hdr is the table inside sampledb database...

    can any one say where a'm i going wrong
    Narayanan Dayalan - Zeetaa Business Solutions
    Wednesday, October 28, 2009 11:35 AM


  • You need to use the OPENQUERY command when using the sp_addlinkedserver

    Try something like this.

    SELECT * FROM OPENQUERY( sampledb951, 'Select statement') Order By column
    Tuesday, November 3, 2009 5:40 AM