Database permissions

Download sql-server eBook

Remarks

Basic Syntax:

{GRANT| REVOKE | DENY} {PERMISSION_NAME} [ON {SECURABLE}] TO {PRINCIPAL};
  • {GRANT| REVOKE | DENY} - What you're trying to accomplish
    • Grant: "Give this permission to the stated principal"
    • Revoke: "Take this permission away from the stated principal"
    • Deny: "Make sure the stated principal never has this permission (i.e. "DENY SELECT" means that regardless of any other permissions, SELECT will fail for this principal)
  • PERMISSION_NAME - The operation that you're attempting to affect. This will depend on the securable. For instance, it doesn't make sense to GRANT SELECT on a stored procedure.
  • SECURABLE - The name of the thing on which you're trying to affect permissions on. This is optional. Saying GRANT SELECT TO [aUser]; is perfectly acceptable; it means "for any securable for which the SELECT permission makes sense, GRANT that permission".
  • PRINCIPAL - For whom you are trying to affect permissions. At a database level, this can be a role (application or database) or user (mapped to a login or not) for example.

Related Examples

Stats

35 Contributors: 1
Thursday, September 15, 2016
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook