Revoke Permissions on an XML Schema Collection

The permission to create an XML schema collection can be revoked by using one of the following:

Revoke the ALTER permission for the relational schema. Then, the principal cannot create an XML schema collection in the relational schema. However, the principal can still do so in other relational schemas in the same database.

Revoke the ALTER ANY SCHEMA permission on the database for the principal. Then, the principal cannot create an XML schema collection anywhere in the database.

Revoke the CREATE XML SCHEMA COLLECTION or ALTER XML SCHEMA COLLECTION permission on the database for the principal. This prevents the principal from importing an XML schema collection within the database. Revoking the ALTER or CONTROL permission on the database has the same effect.

Following are the permissions that can be revoked on an XML schema collection and the results:

Revoking the ALTER permission revokes a principal's ability to modify the content of the XML schema collection.

Revoking the TAKE OWNERSHIP permission revokes a principal's ability to transfer ownership of the XML schema collection.

Revoking the REFERENCES permission revokes a principal's ability to use the XML schema collection for typing or constraining xml type columns, in tables and views, and parameters. It also revokes the permission to refer to this schema collection from other XML schema collections.

Revoking the VIEW DEFINITION permission revokes a principal's ability to view the contents of an XML schema collection.

Revoking the EXECUTE permission revokes a principal's ability to insert or update values in columns, variables, and parameters that are typed or constrained by the XML collection. It also revokes the ability to query such xml type columns, variables, or parameters.

The scenarios in the following examples illustrate how XML schema permissions work. Each example creates the necessary test database, relational schemas, and logins. These logins are granted the necessary XML schema collection permissions. Each example does the necessary cleanup at the end.

This example creates a login and a sample database. It also adds a relational schema in the database. Initially, the login is granted ALTER permission on both relational schemas and other necessary permissions to create XML schema collections. The example then revokes the ALTER permission on one of the relational schemas in the database. This prevents the login from creating an XML schema collection.