1
我需要知道用户拥有哪些权限。是否有一个视图或存储过程允许知道用户对SQL Server中的视图的权限?
我在寻找像INFORMATION_SCHEMA.TABLE_PRIVILEGES
或sp_table_privileges
之类的东西,而不是表格。有没有?
我需要知道用户拥有哪些权限。是否有一个视图或存储过程允许知道用户对SQL Server中的视图的权限?
我在寻找像INFORMATION_SCHEMA.TABLE_PRIVILEGES
或sp_table_privileges
之类的东西,而不是表格。有没有?
我的猜测是,你要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()
)