Error in Dynamic open row set query

  • declare @server as varchar(50)

    SELECT @server = RTrim(ServerName) FROM master.dbo.ServerList1 WITH (nolock) WHERE ServerName = @server

    print @server

    Insert Into dbo.Server_Details_Table

    select A.*

    FROM

    OPENROWSET ('SQLNCLI10', 'Server=''+ @server +'';trusted_connection=yes',

    'set fmtonly off exec [MASTER].[dbo].[SP_SQL_SINFO]')as A

    SERVERLIST CONTAINS 2 CLOUMNS

    SERVERNUMBER,SERVERNAME .

    WHEN EXECUTED IT IS GIVING ERROR THAT

    OLE DB provider "SQLNCLI10" for linked server "(null)" returned message "Login timeout expired".

    OLE DB provider "SQLNCLI10" for linked server "(null)" returned message "A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.".

    Msg 53, Level 16, State 1, Line 0

    Named Pipes Provider: Could not open a connection to SQL Server [53].

    Unable to find out error

    Thanks in advance

    e

  • Please don't cross post. It just wastes people's time and fragments replies

    No replies to this thread please. Direct replies to http://www.sqlservercentral.com/Forums/Topic1027319-338-1.aspx

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

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

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