Wednesday, July 07, 2010

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

No comments: