I have developer edition from SQL Server 2008, but now I have a piece of software with a hardcoded connection string:

Data Source=.\SQLEXPRESS;Initial Catalog=db;User Id=sa;Password=1234;

Now I tried adding an Alias in the configuration tool to SQLEXPRESS, but it just doesn't want to use this new alias.

I enabled TCP/IP and restarted the service.


1 Answer 1


Follow these steps to add an alias:

  1. Open SQL Server Configuration Manager
  2. Expand SQL Native Client Configuration
  3. Right-click Aliases and select New Alias...
  4. On the New Alias window:
    • Enter .\SQLEXPRESS for the Alias Name.
    • Select the appropriate protocol (e.g., Named Pipes)
    • Enter . for the server name (that's equivalent to localhost).
  5. Click on OK to make the change.

Changing the HOSTS file to include a setting for SQLEXPRESS will only redirect DNS lookups for a machine called SQLEXPRESS to the specified IP address. That will not cause .\SQLEXPRESS to resolve to the localhost SQL instance.

  • 1
    Great answer! I was just about to start using explicit port numbers and so on when I happened upon this answer. This solved my problems perfectly. Thank you! :)
    – wasatz
    Commented Oct 29, 2013 at 13:50
  • 9
    If you are using 64-bit Windows you might need to create the alias in both the 32-bit and 64-bit SQL Native Client Configuration. Commented Jun 4, 2014 at 1:49
  • I found my issue was with trying to use TCP, changing the alias to use named pipes made it work.
    – BlackICE
    Commented Sep 11, 2014 at 15:15
  • 2
    If it helps anybody else, I had to use the following Pipe Name for the .\SQLEXPRESS alias to work with my named dev instance: \\.\pipe\MSSQL$STOLLEDEV\sql\query Commented Apr 7, 2015 at 18:11
  • 1
    In addition to the above advice I also added localhost\SQLEXPRESS as an alias gets treated explicitly. I also added both aliases to both my 32bit and 64bit configuration just for belt and braces. Commented Dec 5, 2017 at 12:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .