SQL Server Performance

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

Discussion in 'SQL Server 2005 General DBA Questions' started by mpolaiah, Aug 7, 2009.

  1. mpolaiah New Member

    Hi All,
    i am run the sqlcmd the following erros is came how to slove...........like.......
    SET @SQLCmd ='sqlcmd -d SMS -q "set nocount on;Select * From TEMP_AH_PRE_REQUEST_DETAILS where nrequestid='+CAST(@nRequestid AS VARCHAR(100)) +'" -o"' + @FilePath + '" -W -s "' + '#' + '" -h -1'
    EXEC master..xp_cmdshell @SQLCmd
    here i am export the data in text file but
    the text file comes these error
    HResult 0x2, Level 16, State 1
    Named Pipes Provider: Could not open a connection to SQL Server [2].
    Sqlcmd: Error: Microsoft SQL Native Client : An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections..
    Sqlcmd: Error: Microsoft SQL Native Client : Login timeout expired.
  2. madhuottapalam New Member

    Check this blog entry http://blogs.msdn.com/sql_protocols...ql-server-microsoft-sql-server-error-xxx.aspx.
    Basically you will find your issue in the following section
    3) xxx = 2
    winerr 2 means "The system cannot find the file specified". This error message means the client can reach the server but there is no Named Pipe listener with specific pipe name on the target machine. It also means the account can have a file sharing session without a problem.Possible reasons are:
    a) typo in instance name or wrong instance name. The instance name is not the one you are targeting. Note that for default instance, you shouldn't use MSSQLSERVER as instance name.
    check service is running
    you may also check the service account of you SQLSERVER Service. Check if that user have permission to the file. For troubleshooting purpose change the user to local system and check.
    also check if the sql browser service is running
    Madhu

Share This Page