Hello Friends one requriment face last days from my boss was he said me that get all active connection in any database in sql server. mean give me list of all user which are currently connected to the our live database.

so fullfill this requriment with below solution so please write this query it will make your boss happier also

this query is for all database on server.

SELECT db_name(dbid) as DatabaseName, count(dbid) as NoOfConnections,
loginame as LoginName
FROM sys.sysprocesses
WHERE dbid > 0
GROUP BY dbid, loginame

please tell your boss and get increment in your salary.

Tags:

This entry was posted on Wednesday, October 8th, 2008 at 2:41 am and is filed under Sql Server. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

3 comments so far

 1 

hi
q6pvyb1ecdjaguvm
good luck

January 8th, 2009 at 8:15 pm
 2 

hi
q6pvyb1ecdjaguvm
good luck

January 8th, 2009 at 8:15 pm
 3 

hi
q6pvyb1ecdjaguvm
good luck

January 10th, 2009 at 9:00 am

Leave a reply

Name (*)
Mail (will not be published) (*)
URI
Comment