DENY Endpoint Permissions (Transact-SQL)
Applies To: SQL Server
Denies permissions on an endpoint.
Applies to: SQL Server (SQL Server 2008 through current version).
DENY permission [ ,...n ] ON ENDPOINT :: endpoint_name TO < server_principal > [ ,...n ] [ CASCADE ] [ AS SQL_Server_login ] <server_principal> ::= SQL_Server_login | SQL_Server_login_from_Windows_login | SQL_Server_login_from_certificate | SQL_Server_login_from_AsymKey
Specifies a permission that can be denied on an endpoint. For a list of the permissions, see the Remarks section later in this topic.
- ON ENDPOINT :: endpoint_name
Specifies the endpoint on which the permission is being denied. The scope qualifier (::) is required.
- TO <server_principal>
Specifies the SQL Server login to which the permission is being denied.
Specifies the name of a SQL Server login.
Specifies the name of a SQL Server login created from a Windows login.
Specifies the name of a SQL Server login mapped to a certificate.
Specifies the name of a SQL Server login mapped to an asymmetric key.
Indicates that the permission being denied is also denied to other principals to which it has been granted by this principal.
- AS SQL_Server_login
Specifies the SQL Server login from which the principal executing this query derives its right to deny the permission.
Permissions at the server scope can be denied only when the current database is master.
Information about endpoints is visible in the sys.endpoints catalog view. Information about server permissions is visible in the sys.server_permissions catalog view, and information about server principals is visible in the sys.server_principals catalog view.
An endpoint is a server-level securable. The most specific and limited permissions that can be denied on an endpoint are listed in the following table, together with the more general permissions that include them by implication.
Implied by endpoint permission
Implied by server permission
ALTER ANY ENDPOINT
VIEW ANY DEFINITION
Requires CONTROL permission on the endpoint or ALTER ANY ENDPOINT permission on the server.
The following example denies VIEW DEFINITION permission on the endpoint Mirror7 to the SQL Server login ZArifin.
USE master; DENY VIEW DEFINITION ON ENDPOINT::Mirror7 TO ZArifin; GO
The following example denies TAKE OWNERSHIP permission on the endpoint Shipping83 to the SQL Server user PKomosinski and to principals to which PKomosinski granted TAKE OWNERSHIP.
USE master; DENY TAKE OWNERSHIP ON ENDPOINT::Shipping83 TO PKomosinski CASCADE; GO