Find the Port a Connection is Using in Sql Server

SELECT c.session_id, c.local_tcp_port, s.login_name, s.host_name, s.program_name
FROM sys.dm_exec_connections AS c INNER JOIN
            sys.dm_exec_sessions AS s on c.session_id = s.session_id
WHERE c.local_tcp_port 1433

I found this very useful when monitoring external access to your Sql Server instance.

The original post was here at SqlServerCentral

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.