Is there a view or stored procedure that allows knowing privileges user's have over views in SQL Server?
I need to know which views does a user have which privileges on.
I'm searching for something like INFORMATION_SCHEMA.TABLE_PRIVILEGES
or sp_table_privileges
but for views instead of tab开发者_如何转开发les. Is there any?
my guess is you want sys.database_permission
-- Find permissions granted to current user directly or that are inherited
-- from groups or roles
--
select permission_name from sys.database_permissions
where grantee_principal_id in
(
select user_id()
union
select dbp.principal_id from sys.login_token lt, sys.database_principals dbp
where lt.sid = dbp.sid
union
select dbrm.role_principal_id from sys.database_role_members dbrm
where dbrm.member_principal_id = user_id()
)
精彩评论