After installing new SQL server 2008 R2 in Windows Server and connection to sql using “sqlcmd.exe” in command prompt gave below error-
HResult 0x2, Level 16, State 1 Named Pipes Provider: Could not open a connection to SQL Server . Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : A network-related or in stance-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 i f SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.. Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : Login timeout expired.
To fix this problem , change the Named pipe value from below \\.\pipe\MSSQL$SQLEXPRESS\sql\query to
\\.\pipe\sql\query using SQL Server Configuration Manager.