This query will will return you database wise and login wise total no of connections on the database server.
GO
SELECT DB_NAME(dbid) AS DatabaseName, loginame AS LoginName, COUNT(dbid) AS TotalConnections
FROM sys.sysprocesses
WHERE dbid > 0
GROUP BY dbid, loginame
GO
sp_who2 system stored procedure provides information about the concurrent users and connection, with "Active" parameter it excludes sessions that are waiting for the next command from the user.
sp_who2 'Active'
GOBelow query will will return total of of the current connection on the Database Server.
SELECT COUNT(dbid) as TotalConnections FROM sys.sysprocesses WHERE dbid > 0
No comments:
Post a Comment