--- title: "DENY Server Permissions (Transact-SQL) | Microsoft Docs" ms.custom: "" ms.date: "06/09/2017" ms.prod: "sql-non-specified" ms.reviewer: "" ms.suite: "" ms.technology: - "database-engine" ms.tgt_pltfrm: "" ms.topic: "language-reference" dev_langs: - "TSQL" helpviewer_keywords: - "permissions [SQL Server], servers" - "denying permissions [SQL Server], servers" - "servers [SQL Server], permissions" - "DENY statement, servers" ms.assetid: 68d6b2a9-c36f-465a-9cd2-01d43a667e99 caps.latest.revision: 34 author: "BYHAM" ms.author: "rickbyh" manager: "jhubbard" --- # DENY Server Permissions (Transact-SQL) [!INCLUDE[tsql-appliesto-ss2008-asdb-xxxx-xxx_md](../../includes/tsql-appliesto-ss2008-asdb-xxxx-xxx-md.md)] Denies permissions on a server. ![Topic link icon](../../database-engine/configure-windows/media/topic-link.gif "Topic link icon") [Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md) ## Syntax ``` DENY permission [ ,...n ] TO [ ,...n ] [ CASCADE ] [ AS ] ::= SQL_Server_login | SQL_Server_login_mapped_to_Windows_login | SQL_Server_login_mapped_to_Windows_group | SQL_Server_login_mapped_to_certificate | SQL_Server_login_mapped_to_asymmetric_key | server_role ::= SQL_Server_login | SQL_Server_login_mapped_to_Windows_login | SQL_Server_login_mapped_to_Windows_group | SQL_Server_login_mapped_to_certificate | SQL_Server_login_mapped_to_asymmetric_key | server_role ``` ## Arguments *permission* Specifies a permission that can be denied on a server. For a list of the permissions, see the Remarks section later in this topic. CASCADE Indicates that the permission being denied is also denied to other principals to which it has been granted by this principal. TO \ Specifies the principal to which the permission is denied. AS \ Specifies the principal from which the principal executing this query derives its right to deny the permission. *SQL_Server_login* Specifies a [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] login. *SQL_Server_login_mapped_to_Windows_login* Specifies a [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] login mapped to a Windows login. *SQL_Server_login_mapped_to_Windows_group* Specifies a [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] login mapped to a Windows group. *SQL_Server_login_mapped_to_certificate* Specifies a [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] login mapped to a certificate. *SQL_Server_login_mapped_to_asymmetric_key* Specifies a [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] login mapped to an asymmetric key. *server_role* Specifies a server role. ## Remarks Permissions at the server scope can be denied only when the current database is master. Information about server permissions can be viewed in the [sys.server_permissions](../../relational-databases/system-catalog-views/sys-server-permissions-transact-sql.md) catalog view, and information about server principals can be viewed in the [sys.server_principals](../../relational-databases/system-catalog-views/sys-server-principals-transact-sql.md) catalog view. Information about membership of server roles can be viewed in the [sys.server_role_members](../../relational-databases/system-catalog-views/sys-server-role-members-transact-sql.md) catalog view. A server is the highest level of the permissions hierarchy. The most specific and limited permissions that can be denies on a server are listed in the following table. |Server permission|Implied by server permission| |-----------------------|----------------------------------| |ADMINISTER BULK OPERATIONS|CONTROL SERVER| |ALTER ANY AVAILABILITY GROUP

**Applies to**: [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] ([!INCLUDE[ssSQL11](../../includes/sssql11-md.md)] through [current version](http://go.microsoft.com/fwlink/p/?LinkId=299658)).|CONTROL SERVER| |ALTER ANY CONNECTION|CONTROL SERVER| |ALTER ANY CREDENTIAL|CONTROL SERVER| |ALTER ANY DATABASE|CONTROL SERVER| |ALTER ANY ENDPOINT|CONTROL SERVER| |ALTER ANY EVENT NOTIFICATION|CONTROL SERVER| |ALTER ANY EVENT SESSION|CONTROL SERVER| |ALTER ANY LINKED SERVER|CONTROL SERVER| |ALTER ANY LOGIN|CONTROL SERVER| |ALTER ANY SERVER AUDIT|CONTROL SERVER| |ALTER ANY SERVER ROLE

**Applies to**: [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] ([!INCLUDE[ssSQL11](../../includes/sssql11-md.md)] through [current version](http://go.microsoft.com/fwlink/p/?LinkId=299658)).|CONTROL SERVER| |ALTER RESOURCES|CONTROL SERVER| |ALTER SERVER STATE|CONTROL SERVER| |ALTER SETTINGS|CONTROL SERVER| |ALTER TRACE|CONTROL SERVER| |AUTHENTICATE SERVER|CONTROL SERVER| |CONNECT ANY DATABASE

**Applies to**: [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] ([!INCLUDE[ssSQL14](../../includes/sssql14-md.md)] through [current version](http://go.microsoft.com/fwlink/p/?LinkId=299658)).|CONTROL SERVER| |CONNECT SQL|CONTROL SERVER| |CONTROL SERVER|CONTROL SERVER| |CREATE ANY DATABASE|ALTER ANY DATABASE| |CREATE AVAILABILITY GROUP

**Applies to**: [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] ([!INCLUDE[ssSQL11](../../includes/sssql11-md.md)] through [current version](http://go.microsoft.com/fwlink/p/?LinkId=299658)).|ALTER ANY AVAILABILITY GROUP| |CREATE DDL EVENT NOTIFICATION|ALTER ANY EVENT NOTIFICATION| |CREATE ENDPOINT|ALTER ANY ENDPOINT| |CREATE SERVER ROLE

**Applies to**: [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] ([!INCLUDE[ssSQL11](../../includes/sssql11-md.md)] through [current version](http://go.microsoft.com/fwlink/p/?LinkId=299658)).|ALTER ANY SERVER ROLE| |CREATE TRACE EVENT NOTIFICATION|ALTER ANY EVENT NOTIFICATION| |EXTERNAL ACCESS ASSEMBLY|CONTROL SERVER| |IMPERSONATE ANY LOGIN

**Applies to**: [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] ([!INCLUDE[ssSQL14](../../includes/sssql14-md.md)] through [current version](http://go.microsoft.com/fwlink/p/?LinkId=299658)).|CONTROL SERVER| |SELECT ALL USER SECURABLES

**Applies to**: [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] ([!INCLUDE[ssSQL14](../../includes/sssql14-md.md)] through [current version](http://go.microsoft.com/fwlink/p/?LinkId=299658)).|CONTROL SERVER| |SHUTDOWN|CONTROL SERVER| |UNSAFE ASSEMBLY|CONTROL SERVER| |VIEW ANY DATABASE|VIEW ANY DEFINITION| |VIEW ANY DEFINITION|CONTROL SERVER| |VIEW SERVER STATE|ALTER SERVER STATE| ## Remarks The following three server permissions were added in [!INCLUDE[ssSQL14](../../includes/sssql14-md.md)]. **CONNECT ANY DATABASE** Permission Grant **CONNECT ANY DATABASE** to a login that must connect to all databases that currently exist and to any new databases that might be created in future. Does not grant any permission in any database beyond connect. Combine with **SELECT ALL USER SECURABLES** or **VIEW SERVER STATE** to allow an auditing process to view all data or all database states on the instance of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)]. **IMPERSONATE ANY LOGIN** Permission When granted, allows a middle-tier process to impersonate the account of clients connecting to it, as it connects to databases. When denied, a high privileged login can be blocked from impersonating other logins. For example, a login with **CONTROL SERVER** permission can be blocked from impersonating other logins. **SELECT ALL USER SECURABLES** Permission When granted, a login such as an auditor can view data in all databases that the user can connect to. When denied, prevents access to objects unless they are in the **sys** schema. ## Permissions Requires CONTROL SERVER permission or ownership of the securable. If you use the AS clause, the specified principal must own the securable on which permissions are being denied. ## Examples ### A. Denying CONNECT SQL permission to a SQL Server login and principals to which the login has regranted it The following example denies `CONNECT SQL` permission to the [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] login `Annika` and to the principals to which she has granted the permission. ``` USE master; DENY CONNECT SQL TO Annika CASCADE; GO ``` ### B. Denying CREATE ENDPOINT permission to a SQL Server login using the AS option The following example denies `CREATE ENDPOINT` permission to the user `ArifS`. The example uses the `AS` option to specify `MandarP` as the principal from which the executing principal derives the authority to do so. ``` USE master; DENY CREATE ENDPOINT TO ArifS AS MandarP; GO ``` ## See Also [GRANT (Transact-SQL)](../../t-sql/statements/grant-transact-sql.md) [DENY (Transact-SQL)](../../t-sql/statements/deny-transact-sql.md) [DENY Server Permissions (Transact-SQL)](../../t-sql/statements/deny-server-permissions-transact-sql.md) [REVOKE Server Permissions (Transact-SQL)](../../t-sql/statements/revoke-server-permissions-transact-sql.md) [Permissions Hierarchy (Database Engine)](../../relational-databases/security/permissions-hierarchy-database-engine.md) [sys.fn_builtin_permissions (Transact-SQL)](../../relational-databases/system-functions/sys-fn-builtin-permissions-transact-sql.md) [sys.fn_my_permissions (Transact-SQL)](../../relational-databases/system-functions/sys-fn-my-permissions-transact-sql.md) [HAS_PERMS_BY_NAME (Transact-SQL)](../../t-sql/functions/has-perms-by-name-transact-sql.md)