How To: Get SQL Server Port

Posted Tuesday December 18, 2012 at 7:22:38 pm in Development

In case you are wondering how to get the port that your SQL Server instance is listening on:

SELECT local_tcp_port 
FROM sys.dm_exec_connections 
WHERE local_tcp_port IS NOT NULL

FWIW, the default SQL Server port is 1433.

Happy coding!

The opinions expressed herein are my own personal opinions and do not represent my employer’s view