SQL Server: how to check securables
- by jrara
I would like to make a t-sql query to check which logins have 'view server state' permission in server type securables. How to achieve this?
This query from mssqltips don't show this:
http://www.mssqltips.com/tip.asp?tip=1718
SELECT prin.[name] [User], sec.state_desc + ' ' + sec.permission_name [Permission]
FROM [sys].[database_permissions] sec
JOIN [sys].[database_principals] prin
ON sec.[grantee_principal_id] = prin.[principal_id]
WHERE sec.class = 0
ORDER BY [User], [Permission];