I have setup a SQL Server 2019 instance on my machine which has a computer name in a format like this:
My SQL instance is named 'SQL2019', therefore I connect to my local SQL instance by supplying the following name:
I have scripts which rely on server aliases, e.g.
To set these up, I navigated to the 'Sql Server Configuration Manager' and performed the following steps:
- Navigate to 'Protocols for SQL2019' and enabled 'TCP/IP'
- Navigated to the 'Aliases' for 'SQL Native Client 11.0 Configuration (32bit)'
- Created the alias 'Alias1' pointing to my server name: AB-ABC1234ABAB\SQL2019 and protocol 'tcp'
- Repeated above step for alias 2
- Repeated above two steps for the 'SQL Native Client 11.0 Configuration' also.
- Opened Windows Services and restarted the 'SQL Server (SQL2019)' service.
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."