SQL Server 2019: Two Aliases point to same instance

All we need is an easy explanation of the problem, so here it is.

We have a SQL Server 2008 server that I successfully migrated to a new computer with SQL Server 2019.

The SQL Server 2008 server name is

It has two instances named: and\ABC.

The SQL Server 2019 server name is CMP123456.

The instances are named: CMP123456 and CMP123456\ABC.

I would like to use aliases on the 2019 server because unfortunately some programmers hardcoded the instance names into their code.

I created two aliases:

[      TCP    1433    localhost]    
[\ABC  TCP    1433    localhost\ABC]

When I use SSMS to login, however both aliases connect me to CMP123456. I am unable to create an alias that will connect me to CMP123456\ABC.

These are the aliases I have tried.

They all fail as "server not found" errors:

[\ABC  TCP    1434   localhost\ABC]   
[\ABC  TCP    1433   CMP123456\ABC]    
[\ABC  TCP    1433   ABC]
[(No Alias) In this case I was hoping the one localhost alias would work for both instances.]

Any ideas? Is not allowing two aliases a bug/feature of SQL Server 2019?

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

For the first two aliases you point both to 1433, which is the default instance. That explains why both of then goes to the default instance (the port number takes precedence over the \instance name).

In your alias config, either specify a backslash with the instance name or specify the port name for the alias which is to point to the named instance.

Also, remember that SSMS is a 32 bit app, so SSMS check the 32 bit alias configs (not the 64 bit configs).

Aliases is a client config, so you will have do this on all your client machines (that need these aliases). The info is in the registry, so you could push out those registry entries by some automated means. Note that you probably want to push out both the 32 and 64 bit registry entries (so the aliases exists for both types of apps). The 32 and 64 bit registry entries are in different places in the registry.

DNS won’t help you here, since a DNS entry can’t have an \Instance name. That is why some people have each instances have a separate IP adress and then have all instances listning on port 1433 (on their IP), to facilitate "rerouting" through DNS config. That won’t help you here since you already have clients including the instance name in the connection string.

Method 2

There is a naming convention

in your case

NetBIOS computer names can't contain the following characters:    
    backslash (\)    
    slash mark (/)    
    colon (:)   
    asterisk (*)    
    question mark (?)    
    quotation mark (")    
    less than sign (<)    
    greater than sign (>)    
    vertical bar (|)

see more


Also don’t name a computer localhost it is really really bad, as you don’t folow the the convention

The name localhost is reserved for loopback purposes by RFC 6761 (Special-Use Domain Names),[4] which achieved the Proposed Standard maturity level in February 2013. The standard sets forth a number of special considerations governing the use of the name in the Domain Name System

see wikipedia

in short localhost is bad and the second name is against naming and will not work

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply