码迷,mamicode.com
首页 > 数据库 > 详细

Security10:Grant object Permission to DB Role or User

时间:2016-06-23 14:18:30      阅读:177      评论:0      收藏:0      [点我收藏+]

标签:

1,将访问Object的权限授予Database Role 或 User 的语法如下

GRANT <permission> [ ,...n ] 
ON [ OBJECT :: ][ schema_name ]. object_name [ ( column [ ,...n ] ) ]  
TO [Database_user | Database_role] [ ,...n ]   
[ WITH GRANT OPTION ] 

An object is a schema-level securable contained by the schema that is its parent in the permissions hierarchy. The most specific and limited permissions that can be granted on an object are listed in the following table, together with the more general permissions that include them by implication.

Object Permission 是使用该语句能够授予的Permission,而

Object permissionImplied by object permissionImplied by schema permission
ALTER CONTROL ALTER
CONTROL CONTROL CONTROL
DELETE CONTROL DELETE
EXECUTE CONTROL EXECUTE
INSERT CONTROL INSERT
RECEIVE CONTROL CONTROL
REFERENCES CONTROL REFERENCES
SELECT RECEIVE SELECT
TAKE OWNERSHIP CONTROL CONTROL
UPDATE CONTROL UPDATE
VIEW CHANGE TRACKING CONTROL VIEW CHANGE TRACKING
VIEW DEFINITION CONTROL VIEW DEFINITION

 

Examples

A. Grant SELECT permission to user RosaQdM on table Person.Address.

GRANT SELECT 
ON OBJECT::Person.Address 
TO RosaQdM; 

B. Grants EXECUTE permission on stored procedure HumanResources.uspUpdateEmployeeHireInfo to an database role called Recruiting11.

GRANT EXECUTE 
ON OBJECT::HumanResources.uspUpdateEmployeeHireInfo  
TO Recruiting11; 


C.Grant REFERENCES permission on column BusinessEntityID in view HumanResources.vEmployee to user Wanida with GRANT OPTION.

GRANT REFERENCES (BusinessEntityID) 
ON OBJECT::HumanResources.vEmployee   
TO Wanida WITH GRANT OPTION;

D.Grant EXECUTE permission on procedure uspGetBillOfMaterials to a database role

GRANT EXECUTE 
ON dbo.uspGetBillOfMaterials 
TO newrole ;  

 

参考doc:

GRANT Object Permissions (Transact-SQL)

Security10:Grant object Permission to DB Role or User

标签:

原文地址:http://www.cnblogs.com/ljhdo/p/5610552.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!