There might be occasions when trying to connect to a SQL 2008 R2 Instance with SQLCMD that you might receive the error :-
Named Pipes Provider: Could not open a connection to SQL Server. Microsoft SQL Server Native Client 10.0 : Login timeout expired.
The full error can be seen in the screenshot below :
The issue is caused by something to do with the value that is returned by default in the configured Named pipes. To stop this happening and to allow us to connect we need to do the steps below :-
– Open SQL Server Configuration Manager
– Branch out SQL Server Network Configuration
– Click on the Protocols for your instance.
– In the right hand pane, right click on Named pipes and then click properties.
– Change the value in the field Pipe Name to
\\.\pipe\sql\query
Click ok. Then restart the SQL Instance. You should now be able to connect to the instance.