DENY (TSQL Statement)

denies permission(s) ON the specified object TO the specified principal(s).

Syntax

DENY <permission> [,... n]
    ON [schema_name .] object_name
    TO principal [,... n]

<permission> ::= SELECT | UPDATE | INSERT | DELETE

Arguments

<permission>
is a permission that can be denied on the object.
[schema_name.]object_name
is the object on which the permission(s) will be denied.
principal
is the name of a user or a role to which the permission(s) will be denied.

Remarks

Only sa or dbo is allowed to execute this statement.

To remove a “deny permission”, use REVOKE permissions.

The command SHOW PERM U displays the list of users and roles, and their permissions.

The command SHOW PERM T displays the list of tables, and the permissions on them.

Examples

DENY SELECT, UPDATE ON clients TO igor, alice;
RSQL, a simple alternative to Microsoft SQL Server