Sql-server – SQL Server Alias won’t work for the database instance

aliasconfiguration-managersql server

I have setup a SQL Server 2019 instance on my machine which has a computer name in a format like this:

AB-ABC1234ABAB

My SQL instance is named 'SQL2019', therefore I connect to my local SQL instance by supplying the following name:

AB-ABC1234ABAB\SQL2019

I have scripts which rely on server aliases, e.g.

  • Alias1
  • Alias2

To set these up, I navigated to the 'Sql Server Configuration Manager' and performed the following steps:

  1. Navigate to 'Protocols for SQL2019' and enabled 'TCP/IP'
  2. Navigated to the 'Aliases' for 'SQL Native Client 11.0 Configuration (32bit)'
  3. Created the alias 'Alias1' pointing to my server name: AB-ABC1234ABAB\SQL2019 and protocol 'tcp'
  4. Repeated above step for alias 2
  5. Repeated above two steps for the 'SQL Native Client 11.0 Configuration' also.
  6. Opened Windows Services and restarted the 'SQL Server (SQL2019)' service.

enter image description here

In SQL Server Management Studio, I have connected to my instance using Windows authentication, then I have created a new login and selected 'SQL Server authentication'. I have then been tested that login by logging in by specifying the computer name as the server (AB-ABC1234ABAB\SQL2019). Then I have disconnected and typed the alias name (e.g. Alias1) in the login box, selected SQL Server authentication and supplied the same login I used earlier.

When I do this, the connection attempt times out. It appears neither alias works for me.

Error I get is the standard one, e.g. "provider: SQL Network Interfaces, error: 26 – Error Locating Server/Instance Specified)".

What steps can I take to troubleshoot this issue? Could the hyphen in the server name be cause for concern?

I noticed that if I delete the SQL alias I get a slightly different error: "error: 40 – Could not open a connection to SQL Server – the network path was not found."

Best Answer

The problem was that the 'SQL Server Browser' service was not running.

enter image description here

I right-clicked this, clicked 'Properties', set the start mode to 'Automatic' then manually selected to start the service.