Last active
April 12, 2019 12:45
-
-
Save ArtemAvramenko/642aac6ebac75c77243c5a347892a1fa to your computer and use it in GitHub Desktop.
Query current SQL Server connections
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select | |
count = count(*), | |
db_name = db_name(database_id), | |
status, | |
login_name, | |
host_name, | |
program_name | |
from sys.dm_exec_sessions | |
where is_user_process = 1 | |
group by database_id, status, login_name, host_name, program_name | |
order by 1 desc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment