Ease your Visual Studio development with a SQL Server alias

A quick little tip on how to manage connection strings in your applications with a SQL Alias that you can create with “SQL Server Configuration Manager”
SQL Server connection strings in app.config

If you have a specific connection string in your application.config like

    connectionString="Data Source=MyLittleLaptop\SQLExpress; 
     Initial Catalog=Northwind; Persist Security Info=True;
     User ID=userName;Password=password"



In order to avoid

#1 merge conflicts on every check in

#2 to remember to exclude the app.config (or web.config) on every check in

Figure: Exclude the app.config because I needed to change the DB connectionstring to “.\SQLExpress”

#3 getting beaten by other developers


Create a SQL Alias with SQL Server Configuration Manager

  1. Open SQL Configuration Manager
  2. Go to “SQL Native Client 10.0 Configuration (32bit)”
    My client is a 32bit process

  3. Create a new alias
    In my case called: “.\USTER” since that is DB name that we agreed on
    Figure: “.\USTER” points to “.\MSSQL” via Named Pipes
    Figure: “.\USTER” points to “.\MSSQL” via Named Pipes
  4. Ready to rock!



Make sure to enable “Named Pipes” for that SQL instance


Happy days in your development team!

BTW: If you deploy your application to different environments you can and should change server names via “XML transforms” or “XML Parametrizations”

Latest Posts

Popular Posts