Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
vijay1234
Starting Member
48 Posts |
Posted - 2014-07-31 : 11:25:45
|
Hi All,I would require to know a query that will fetch the max concurrent users connected to the databases in a particular server for a particular month.Ex:We have DB's called A,B,C,D ( Excluding sys DB's) in a server called X.So the max list of users connected to the DB - A,B,C,D for a particular month say 'July'Result should be likeDB Max No of Users MonthA 10 JulyB 8 JulyC 45 JulyD 76 JulyHighly appreciate the response friends.Thanks & Regards,Vijay |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-07-31 : 12:26:21
|
Are you storing sysprocesses or similar? If not, then you'll need to start taking a snapshot of the info so that you can later query it.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
vijay1234
Starting Member
48 Posts |
Posted - 2014-07-31 : 22:45:43
|
Hi Tara,Yes. We've got sysprocesses. Any way that i can get a query ?I'm using this SELECT DB_NAME(dbid) AS DBName, COUNT(dbid) AS NumberOfConnections, loginame AS LoginName, nt_domain AS NT_Domain, nt_username AS NT_UserName, hostname AS HostNameFROM sys.sysprocessesWHERE dbid > 0 and DB_NAME(dbid) not in ('master','msdb','model','tempdb')GROUP BY dbid, hostname, loginame, nt_domain, nt_usernameORDER BY NumberOfConnections DESC;But looking for the desired result set as mentioned in my prior one Appreciate your revert on this TaraThanks Vijay |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-08-01 : 12:22:51
|
But are you storing that info? sysprocesses is for the current processes. If you need to go back a month, you have to start storing the data from sysprocesses.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
|
|
|
|
|