This query returns the users and their permissions in a database:
SELECT u.name as user_name, p.state_desc, p.permission_name
FROM sys.server_permissions AS p JOIN sys.server_principals AS u
ON p.grantee_principal_id = u.principal_id
|
|||||
Copyright © 2012 - 2022 SQL Server Administration Blog | zarez.net - All Rights Reserved -
Disclaimer: All information, and code samples, is provided "AS IS" without warranty of any kind. Please verify all the information and code samples before using them. zarez.net shall not be liable for any direct, indirect or consequential damages or costs of any type arising out of using the sample code or any other information from this site. Powered by WordPress & Atahualpa |