MS SQL Tips & Tricks

How to get list of opened connections to current database

To get list of active connections to current database use the query

SELECT nt_domain, nt_username, hostname, loginame, cmd
FROM master.dbo.sysprocesses WITH (NOLOCK)
WHERE dbid = DB_ID(db_name())

Learn more tricks

Add Comment

Comments