This article is a child of frustration. I made the decision to completely remove CRM from one of my machines and then got stuck because I had no idea what port my target SQL Server was listening on.
Note: By default, MS SQL Server Express uses port 1433. But in my case, this wasn't true and so I had to find a way of establishing the port being used.
So, just for reference.
We can find out the port number being used by an instance of MS SQL Server Express in a couple of ways.
- We can use the Configuration Manager
- We can use a T-SQL query.
Using the Configuration Manager
Note: You can access the Configuration Manager through the Windows Start menu by searching for "SQL Server Configuration Manager." BUT if the SQL Configuration Manager does not show in your Windows menus then navigate to c:\windows\system32 and look for a file with the name "SQLServerManagerxx.msc", where xx is the version of SQL Server you have installed. E.g for SQL Server 2019, the name is SQLServerManager15.msc. Double-click it and it will open. You can also make a shortcut on the desktop.
- In SQL Server Configuration Manager, expand the "SQL Server Network Configuration" node and select "Protocols for [instance name]".
- In the right-hand pane, you should see a list of protocols. Look for the TCP/IP protocol and make sure it is enabled.
- Right-click on the TCP/IP protocol and select "Properties."
- In the TCP/IP Properties dialog box, select the "IP Addresses" tab.
- Scroll down to the "IPAll" section and look for the "TCP Port" field. This is the port number being used by your instance of MS SQL Server Express.
Using T-SQL to find out the port used.
If you prefer to use T-SQL you can query the server properties.
SELECT DISTINCT local_tcp_port FROM sys.dm_exec_connections WHERE local_tcp_port IS NOT NULL
This will return the port number being used for TCP/IP connections by the SQL Server instance.