--- title: "GRANT XML Schema Collection Permissions (Transact-SQL) | Microsoft Docs" ms.custom: "" ms.date: "08/10/2017" ms.prod: "sql" ms.prod_service: "sql-database" ms.service: "" ms.component: "t-sql|statements" ms.reviewer: "" ms.suite: "sql" ms.technology: - "database-engine" ms.tgt_pltfrm: "" ms.topic: "language-reference" dev_langs: - "TSQL" helpviewer_keywords: - "GRANT statement, XML schema collections" - "XML schema collections [SQL Server], permissions" - "granting permissions [SQL Server], XML schema collections" - "schema collections [SQL Server], permissions" ms.assetid: 57e24465-cd43-45cf-bb52-eea0b49867f9 caps.latest.revision: 20 author: "douglaslMS" ms.author: "douglasl" manager: "craigg" ms.workload: "Inactive" --- # GRANT XML Schema Collection Permissions (Transact-SQL) [!INCLUDE[tsql-appliesto-ss2008-xxxx-xxxx-xxx-md](../../includes/tsql-appliesto-ss2008-xxxx-xxxx-xxx-md.md)] Grants permissions on an XML schema collection. ![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 ``` GRANT permission [ ,...n ] ON XML SCHEMA COLLECTION :: [ schema_name . ] XML_schema_collection_name TO [ ,...n ] [ WITH GRANT OPTION ] [ AS ] ::= 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 ``` ## Arguments *permission* Specifies a permission that can be granted on an XML schema collection. For a list of the permissions, see the Remarks section later in this topic. ON XML SCHEMA COLLECTION :: [ *schema_name*. ] *XML_schema_collection_name* Specifies the XML schema collection on which the permission is being granted. 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. \ Specifies the principal to which the permission is being granted. WITH GRANT OPTION Indicates that the principal will also be given the ability to grant the specified permission to other principals. AS \ Specifies a principal from which the principal executing this query derives its right to grant the permission. *Database_user* Specifies a database user. *Database_role* Specifies a database role. *Application_role* Specifies an application role. *Database_user_mapped_to_Windows_User* Specifies a database user mapped to a Windows user. *Database_user_mapped_to_Windows_Group* Specifies a database user mapped to a Windows group. *Database_user_mapped_to_certificate* Specifies a database user mapped to a certificate. *Database_user_mapped_to_asymmetric_key* Specifies a database user mapped to an asymmetric key. *Database_user_with_no_login* Specifies a database user with no corresponding server-level principal. ## Remarks Information about XML schema collections is visible in the [sys.xml_schema_collections](../../relational-databases/system-catalog-views/sys-xml-schema-collections-transact-sql.md) catalog view. An XML schema collection is a schema-level securable contained by the schema that is its parent in the permissions hierarchy. The most specific and limited permissions that can be granted on an XML schema collection are listed in the following table, together with the more general permissions that include them by implication. |XML schema collection permission|Implied by XML schema collection permission|Implied by schema permission| |--------------------------------------|-------------------------------------------------|----------------------------------| |ALTER|CONTROL|ALTER| |CONTROL|CONTROL|CONTROL| |EXECUTE|CONTROL|EXECUTE| |REFERENCES|CONTROL|REFERENCES| |TAKE OWNERSHIP|CONTROL|CONTROL| |VIEW DEFINITION|CONTROL|VIEW DEFINITION| ## Permissions The grantor (or the principal specified with the AS option) must have either the permission itself with GRANT OPTION, or a higher permission that implies the permission being granted. If you are using the AS option, the following additional requirements apply. |AS|Additional permission required| |--------|------------------------------------| |Database user|IMPERSONATE permission on the user, membership in the db_securityadmin fixed database role, membership in the db_owner fixed database role, or membership in the sysadmin fixed server role.| |Database user mapped to a Windows login|IMPERSONATE permission on the user, membership in the db_securityadmin fixed database role, membership in the db_owner fixed database role, or membership in the sysadmin fixed server role.| |Database user mapped to a Windows group|Membership in the Windows group, membership in the db_securityadmin fixed database role, membership in the db_owner fixed database role, or membership in the sysadmin fixed server role.| |Database user mapped to a certificate|Membership in the db_securityadmin fixed database role, membership in the db_owner fixed database role, or membership in the sysadmin fixed server role.| |Database user mapped to an asymmetric key|Membership in the db_securityadmin fixed database role, membership in the db_owner fixed database role, or membership in the sysadmin fixed server role.| |Database user not mapped to any server principal|IMPERSONATE permission on the user, membership in the db_securityadmin fixed database role, membership in the db_owner fixed database role, or membership in the sysadmin fixed server role.| |Database role|ALTER permission on the role, membership in the db_securityadmin fixed database role, membership in the db_owner fixed database role, or membership in the sysadmin fixed server role.| |Application role|ALTER permission on the role, membership in the db_securityadmin fixed database role, membership in the db_owner fixed database role, or membership in the sysadmin fixed server role.| ## Examples The following example grants `EXECUTE` permission on the XML schema collection `Invoices4` to the user `Wanida`. The XML schema collection `Invoices4` is located inside the `Sales` schema of the `AdventureWorks2012` database. ``` USE AdventureWorks2012; GRANT EXECUTE ON XML SCHEMA COLLECTION::Sales.Invoices4 TO Wanida; GO ``` ## See Also [DENY XML Schema Collection Permissions (Transact-SQL)](../../t-sql/statements/deny-xml-schema-collection-permissions-transact-sql.md) [REVOKE XML Schema Collection Permissions (Transact-SQL)](../../t-sql/statements/revoke-xml-schema-collection-permissions-transact-sql.md) [sys.xml_schema_collections (Transact-SQL)](../../relational-databases/system-catalog-views/sys-xml-schema-collections-transact-sql.md) [CREATE XML SCHEMA COLLECTION (Transact-SQL)](../../t-sql/statements/create-xml-schema-collection-transact-sql.md) [Permissions (Database Engine)](../../relational-databases/security/permissions-database-engine.md) [Principals (Database Engine)](../../relational-databases/security/authentication-access/principals-database-engine.md)