Vipin Agarwal
Tips & tricks on .Net, SQL & Javascript
Site Sections
Home
Contact
Syndication
Login
Posts
23
Comments
30
Trackbacks
0
<< Find out last modification to the SQL table
|
Home
|
SQL Server - get last executed SQL statement >>
SQL server - get list of active connections to each database
Many times, we want list of all users who are connected to the SQL server - to determine it use the below query. It returns the Database, Number of open connections and logged-in user credentials.
SELECT DB_NAME(dbid) as Database, COUNT(dbid) as Number Of Open Connections,
loginame as LoginName
FROM sys.sysprocesses
WHERE dbid > 0
GROUP BY dbid, loginame
Hope this helps.
Share This Post:
Short Url:
http://wblo.gs/dcg
posted on Monday, March 4, 2013 3:24 PM
Print
Comments
No comments posted yet.
Post Comment
Title
*
Name
*
Email
Url
Comment
*
Remember Me?
Enter the code shown above
Archives
March 2013 (5)
February 2013 (3)
March 2012 (5)
June 2011 (5)
October 2010 (1)
September 2010 (1)
March 2010 (3)
Post Categories
Javascript
ASP.Net
SQL Server 2000/2005
CSS
Classic ASP
Collection of Good sites
Collection of utilities
C#
Copyright © 2005 Vipin
This work is licensed under a
Creative Commons License