|
|
GRANT Object permissions
Grant permissions to system objects, database objects,
Syntax
GRANT SELECT ON [sys.]system_object FROM principal
GRANT EXECUTE ON [sys.]system_object FROM principal
GRANT object_permission [,...n ]
ON Object
TO principal [,...n ]
[WITH GRANT OPTION]
[AS principal ]
Key:
Objects
ASSEMBLY :: assembly
ASYMMETRIC KEY :: asymmetric_key
CERTIFICATE :: certificate
CONTRACT :: contract
ENDPOINT :: endpoint
FULLTEXT CATALOG :: full-text_catalog
LOGIN :: SQL_Server_login
MESSAGE TYPE :: message_type
[OBJECT ::][schema].object [(column [,...n ])]
REMOTE SERVICE BINDING :: remote_binding
ROUTE :: route
SCHEMA :: schema
SERVICE :: service
SYMMETRIC KEY :: symmetric_key
TYPE :: [schema].type
XML SCHEMA COLLECTION :: [schema.] XML_schema_collection
system_object Objects such as stored procedures, functions and views.
principal one of:
user /role /application role
user mapped to a Windows login/group/certificate
user mapped to an asymmetric key
user not mapped to a server principal.
WITH GRANT Also allow the principal to grant this permission to other principals.
object_permission
ALTER/CONTROL/RECEIVE/REFERENCES/IMPERSONATE/
SELECT/UPDATE/INSERT/DELETE/
EXECUTE/TAKE OWNERSHIP/VIEW DEFINITION
ALL - Against an object, GRANT ALL will grant all permissions applicable to the object.
Examples
USE MyDb; GRANT EXECUTE ON sys.MyStoredproc TO public; GO GRANT SELECT ON MyTable.MyColumn TO MyUser; GO
"I don't know if I believe in role models. We're all so different; we're all individuals. In the long run, that's what matters" - Wilson Cruz
Related commands:
REVOKE Object permissions
DENY Object permissions
GRANT User/Role permissions
Equivalent Oracle command: