Adds

Wednesday, 11 March 2015

Get SQL Server Use Which Port Using a Query




SELECT DISTINCT
local_tcp_port
FROM sys.dm_exec_connections
WHERE local_tcp_port IS NOT NULL



This is for specific database


SELECT DISTINCT
    local_tcp_port
FROM sys.dm_exec_connections
WHERE local_tcp_port IS NOT NULL
USE master
GO
xp_readerrorlog 0, 1, N'Server is listening on'
GO