Skip to content

Instantly share code, notes, and snippets.

@raandree
Created March 4, 2020 10:56
Show Gist options
  • Save raandree/103c4c6eeaf42eaa62223a9a88c6378a to your computer and use it in GitHub Desktop.
Save raandree/103c4c6eeaf42eaa62223a9a88c6378a to your computer and use it in GitHub Desktop.
Gets all connection from a SQL server including authentication type
SELECT
s.session_id,
c.connect_time,
s.login_time,
s.login_name,
c.protocol_type,
c.auth_scheme,
s.HOST_NAME,
s.program_name
FROM sys.dm_exec_sessions s
JOIN sys.dm_exec_connections c
ON s.session_id = c.session_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment