SQL Server:对表的权限
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3049085/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
SQL Server: Permissions on table
提问by dotnet-practitioner
SQL Server 2008 :
SQL Server 2008:
How do I find out what kind of roles have what kind of permissions on a given table.
我如何找出什么样的角色对给定的表有什么样的权限。
Thank you in advance.
先感谢您。
采纳答案by Remus Rusanu
You can get all permissions granted in the database and filter out for your table:
您可以获得数据库中授予的所有权限并过滤掉您的表:
select permission_name, state, pr.name
from sys.database_permissions pe
join sys.database_principals pr on pe.grantee_principal_id = pr.principal_id
where pe.class = 1
and pe.major_id = object_id('<table_name>')
and pe.minor_id = 0;
In addition you need to add the built in role permissions (db_owner, db_datareader, db_datawriter etc). Objects may also be accessed through ownership chaining.
此外,您需要添加内置角色权限(db_owner、db_datareader、db_datawriter 等)。也可以通过所有权链接访问对象。
You can always find out your own effective permission on any object by using fn_my_permissions('table_name', 'OBJECT')
您始终可以通过使用找到自己对任何对象的有效权限 fn_my_permissions('table_name', 'OBJECT')