DENY Type Permissions (Transact-SQL)

DENY Type Permissions (Transact-SQL)

 

Updated: June 10, 2016

THIS TOPIC APPLIES TO:yesSQL Server (starting with 2008)yesAzure SQL DatabasenoAzure SQL Data Warehouse noParallel Data Warehouse

Denies permissions on a type in SQL Server.

Topic link icon Transact-SQL Syntax Conventions

  
DENY permission  [ ,...n ] ON TYPE :: [ schema_name . ] type_name  
        TO <database_principal> [ ,...n ]  
    [ CASCADE ]  
    [ AS <database_principal> ]  
  
<database_principal> ::=   
        Database_user   
    | Database_role   
    | Application_role   
    | Database_user_mapped_to_Windows_User   
    | Database_user_mapped_to_Windows_Group   
    | Database_user_mapped_to_certificate   
    | Database_user_mapped_to_asymmetric_key   
    | Database_user_with_no_login  

permission
Specifies a permission that can be denied on a type. For a list of the permissions, see the Remarks section later in this topic.

ON TYPE :: [ schema_name. ] type_name
Specifies the type on which the permission is being denied. The scope qualifier (::) is required. If schema_name is not specified, the default schema will be used. If schema_name is specified, the schema scope qualifier (.) is required.

TO <database_principal>
Specifies the principal to which the permission is being denied.

CASCADE
Indicates that the permission being denied is also denied to other principals to which it has been granted by this principal.

AS <database_principal>
Specifies a principal from which the principal executing this query derives its right to deny the permission.

Database_user
Specifies a database user.

Database_role
Specifies a database role.

Application_role

Applies to: SQL Server 2008 through SQL Server 2016, SQL Database V12.

Specifies an application role.

Database_user_mapped_to_Windows_User

Applies to: SQL Server 2008 through SQL Server 2016.

Specifies a database user mapped to a Windows user.

Database_user_mapped_to_Windows_Group

Applies to: SQL Server 2008 through SQL Server 2016.

Specifies a database user mapped to a Windows group.

Database_user_mapped_to_certificate

Applies to: SQL Server 2008 through SQL Server 2016.

Specifies a database user mapped to a certificate.

Database_user_mapped_to_asymmetric_key

Applies to: SQL Server 2008 through SQL Server 2016.

Specifies a database user mapped to an asymmetric key.

Database_user_with_no_login
Specifies a database user with no corresponding server-level principal.

A type is a schema-level securable contained by the schema that is its parent in the permissions hierarchy.

System_CAPS_ICON_important.jpg Important


GRANT, DENY, and REVOKE permissions do not apply to system types. User-defined types can be granted permissions. For more information about user-defined types, see Working with User-Defined Types in SQL Server.

The most specific and limited permissions that can be denied on a type are listed in the following table, together with the more general permissions that include them by implication.

Type permissionImplied by type permissionImplied by schema permission
CONTROLCONTROLCONTROL
EXECUTECONTROLEXECUTE
REFERENCESCONTROLREFERENCES
TAKE OWNERSHIPCONTROLCONTROL
VIEW DEFINITIONCONTROLVIEW DEFINITION

Requires CONTROL permission on the type. If you use the AS clause, the specified principal must own the type on which permissions are being denied.

The following example denies VIEW DEFINITION permission with CASCADE on the user-defined type PhoneNumber to the KhalidR. PhoneNumber is located in schema Telemarketing.

DENY VIEW DEFINITION ON TYPE::Telemarketing.PhoneNumber   
    TO KhalidR CASCADE;  
GO  

GRANT Type Permissions (Transact-SQL)
REVOKE Type Permissions (Transact-SQL)
CREATE TYPE (Transact-SQL)
Principals (Database Engine)
Permissions (Database Engine)
Securables

Community Additions

ADD
Show:
© 2016 Microsoft