Skip to content

Instantly share code, notes, and snippets.

@josuebasurto
Created September 4, 2012 18:52
Show Gist options
  • Save josuebasurto/3624962 to your computer and use it in GitHub Desktop.
Save josuebasurto/3624962 to your computer and use it in GitHub Desktop.
SQL Server
SELECT DB_NAME(dbid) AS DBName, hostname, program_name, cmd, nt_domain, nt_username, net_address, login_time, last_batch, net_library, loginame
FROM sys.sysprocesses
WHERE (DB_NAME(dbid) NOT IN ('master', 'tempdb', 'msdb'))
ORDER BY hostname
@josuebasurto
Copy link
Author

This query allows you to watch running from master database the activity of the connections of your databases.
I've tested with sa privileges and didn't try with limited.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment