Yesterday I wanted to know which users have what permissions to a database. So I started querying the two tables related to it.
select * from sys.database_permissionsselect * from sys.database_principals
I came up with the following script to suit my needs.
select USER_NAME(perm.grantee_principal_id) AS user_name, princ.principal_id, princ.type_desc AS principal_type_desc,
perm.class_desc,
OBJECT_NAME(perm.major_id) AS object_name,
perm.permission_name, perm.state_desc AS permission_state_desc
from sys.database_permissions perm
inner JOIN sys.database_principals princ
on perm.grantee_principal_id = princ.principal_id
There may be numerous other ways to do this.
Subscribe to:
Post Comments (Atom)
Free Power BI Classes for Week 7 (Last)
Just completed the last class of the F ree P ower BI classes of this series. Today we have covered Adding a canvas background Adding Imag...
-
From the past 3 days I have been working on resolving merged and hidden cells issues when an SSRS reports is exported to excel. ...
-
When I tried to access the report manager after a fresh installation of Sql Server Reporting Serivces 2016 using the url http://localhost/R...
-
I was trying to build an SSIS package that one of my colleagues has created. The first error that was thrown was as below: Exception des...
No comments:
Post a Comment