How to connect Sqlcmd to the server?

Zakaria Marrah picture Zakaria Marrah · Jan 7, 2013 · Viewed 69k times · Source

I just installed SQL Server 2008, and I wanted to use the command editor to execute queries.

To do that I opened the command prompt, and I typed

Sqlcmd -S Serverinstance

but I got an error saying :

Named Pipes Provider: Could not open a connection to SQL Server [53].
Sqlcmd : erreur : Microsoft SQL Server Native Client 10.0 : 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..
Sqlcmd : erreur : Microsoft SQL Server Native Client 10.0 : Login timeout expired

What should I do to get it connected to the server so I can proceed?

Thank you :D.

Answer

Christian Payne picture Christian Payne · Oct 27, 2014

(This one is going to sounds silly) my problem was that I wasn't using capital 'S'

Eg:

C:\> SQLCMD -S localhost\sqlexpress