How to connect to SQL Express

This page gives information on how to connect to SQL Express if the default connection method described on the SMS from SQL Express page is not working. Please follow these steps:

1. By using SQL 2005 configuration manager, please check if both TCPIP and Named Pipes are enabled for SQL Express instance. Also, please make sure SQLBrowser service is running

2. In Configuration manager, please make sure TCPIP and named pipes protocols are enabled properly for SQL client.

3. Please check the error log for the sql express instance and make sure TCPIP and Named pipes are enabled. You shall also see the port for

C:\Program Files\Microsoft SQL Server\MSSQL.x\MSSQL\LOG

4. Try different protocols by using SQLCMD to test

sqlcmd -S np:\\127.0.0.1\pipe\MSSQL$instancename\sql\query
sqlcmd -S tcp:servername\instancename
sqlcmd -S tcp:servername\instancename,portnumber

Note: You may need to change the servername, instancename, portnumber properly according to your server configurations.

Note: This information was originally posted by Peter Yang at the following URL: http://www.eggheadcafe.com/software/aspnet/30324190/sqlcmd-fails-with-login-t.aspx

If you still cannot connect you may try to change the following registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer LoginMode =2

More information