How to control which SQL Server instance localhost points to

configuration, sql-server

Solution

It is very easy using Aliases: 1. Go to SQL Server Configuration. 2. Click on Aliases and setup localhost => localhost\name of your instance 3. do the same thing under 64bit aliases as well

If you have more than once instance localhost might get confused, therefore go to protocols for you name instance and change IP address to 127.0.0.1 which is localhost

Problem

I have 2 instances of SQL Server on my PC, one is SQL Server 2008 R2, the other SQL Server 2012. If I use `LOCALHOST` when connecting to SQL Server, it goes to the SQL Server 2008 R2 instance. I want it to point to the SQL Server 2012 instance. Does anyone know how I can achieve this?

Original source