Using SQL Server 2008 Express as a default instance

Posted on September 13, 2008

Time to upgrade!  After uninstalling SQL Server 2005, I decided that I would try running only the Express version of SQL Server 2008 on my laptop.  After installing, I found that running SQLCMD against the (local) server no longer worked.  For example,

sqlcmd -s (local) -i SomeScript.sql

Resulted in this error:
HResult 0x2, Level 16, State 1
Named Pipes Provider: Could not open a connection to SQL Server [2].
Sqlcmd: Error: 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: Error: Microsoft SQL Server Native Client 10.0 : Login timeout expired.

I had installed SQL Server 2008 Express as the default instance (and I don’t have any other version of SQL Server on this machine), and accepted the default instance name SQLEXPRESS.

SQLCMD is connecting to the instance through named pipes, and the pipe name it connects on for the default instance is

\\.\pipe\sql\query

To connect to a named instance, it connects through the named pipe

\\.\pipe\MSSQL$<instancename>\sql\query

Sure enough, after opening Sql Server Configuration Manager, I expanded the Sql Server Network Configuration, double-clicked on Named Pipes, and was able to see that the pipe name included the instance name SQLEXPRESS.  After changing the pipe name to \\.\pipe\sql\query, my sqlcmd reference to (local) worked great.  Whew.

sqlexpress

 


No Replies to "Using SQL Server 2008 Express as a default instance"


    Got something to say?

    Some html is OK