Microsoft SQL Server Database permissions

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

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.


Got any Microsoft SQL Server Question?