the query to find the users having how how many connections are present in which database.
Code:
SELECT LOGINAME AS 'LOGIN NAME',COUNT(DBID) AS 'NO OF CONNECTIONS EXIST',
DB_NAME(DBID) AS 'DATABASE NAME'
FROM SYS.SYSPROCESSES
WHERE DBID > 0
GROUP BY DBID, LOGINAME
Code:
SELECT LOGINAME AS 'LOGIN NAME',COUNT(DBID) AS 'NO OF CONNECTIONS EXIST',
DB_NAME(DBID) AS 'DATABASE NAME'
FROM SYS.SYSPROCESSES
WHERE DBID > 0
GROUP BY DBID, LOGINAME
No comments:
Post a Comment