XML Schema Collections

An XML schema collection is a database object that defines and validates the structure and data types of XML data stored in columns, variables, or parameters.

In Database Explorer, you can perform operations on XML schema collections using the shortcut menu. Right-click an XML schema collection to access commands for specific tasks, such as duplicating XML schema collections or generating scripts for them.

Create an XML Schema Collection

You can create an XML schema collection in SQL Editor using:

  • Code completion feature to write a script.
  • SQL snippets to insert predefined or custom code.

Duplicate an XML Schema Collection

1. Right-click the required XML schema collection and select Duplicate Object.

2. In the Duplicate Object dialog, configure the object settings:

  • In Destination connection, select the target server.
  • In Destination database, select the target database.
  • In Destination schema, select the target schema.
  • In New object name, specify the object name.
  • Select Drop destination object to drop the destination object if it already exists.
  • Optional: Select Script Changes, then select To New SQL Window to open the generated script in a new SQL document, or To Clipboard to copy it to the clipboard.

3. Click OK.

Delete an XML Schema Collection

1. Right-click the XML schema collection you want to delete and select Delete.

Alternatively, press Delete.

2. Click Yes to confirm the deletion.

Note

You cannot undo the drop operation. Back up the database before you delete the XML schema collection from the database.

Generate a script for an XML Schema Collection

1. Right-click the required XML schema collection, select Generate Script As, then select the statement type.

2. Select one of the following options:

  • To New SQL Window – Opens the script in a new SQL document.
  • To File – Generates the script to a .sql file.
  • To Clipboard – Copies the script to the clipboard.

For more information, see Generate the DDL and DML statements for database objects.

View properties of an XML Schema Collection

To view properties of an XML schema collection, right-click the XML schema collection or the XML Schema Collections node and select Show Details.

Object Viewer opens and provides detailed information about the XML schema collection.

Refresh XML Schema Collections

To update the XML schema collection to reflect the latest changes, right-click the XML schema collection or the XML Schema Collections node and select Refresh.

Alternatively, press F5.

Open the Properties pane

To open the Properties pane, right-click the XML schema collection and select Properties.

Alternatively, press F4.

Filter XML Schema Collections

1. Right-click the XML Schema Collections node and select Filter.

2. In the Filter Settings dialog, configure the filter parameters.

3. Click OK.

Note

When you open the XML Schema Collections node, the number of objects it contains appears in parentheses next to the node name. This number changes based on your filter settings.

Shortcut menu options for an XML Schema Collection

The following table describes the shortcut menu options available for an XML schema collection in Database Explorer.

Name Description
Source Control > Source Control Manager Opens Source Control Manager, where you can track and manage changes to database schema and static data.
When Source Control Manager is already open, this option refreshes it.
Source Control > Commit Opens Source Control Manager with all local changes (if any) selected and ready to commit.
When Source Control Manager is already open, this option refreshes it and selects all local database changes.
Source Control > Get Latest Opens Source Control Manager with all remote changes (if any) selected and ready to retrieve using Get Latest.
When Source Control Manager is already open, this option refreshes it and selects all remote database changes.
Duplicate Object Opens the Duplicate Object dialog to duplicate the XML schema collection.
Generate Script As Generates a script for the selected object using the CREATE, DROP, and DROP and CREATE statements. The script can be saved to a new SQL document or to a file, or copied to the clipboard.
Show Details Opens Object Viewer that displays object details.
Delete Drops the selected XML schema collection from the database.
Shortcut: Delete
Refresh Updates the object to reflect the latest changes.
Shortcut: F5
Properties Opens the Properties pane that displays the object information.
Shortcut: F4

Shortcut menu options for the XML Schema Collections node

The following table describes the shortcut menu options available for the XML Schema Collections node in Database Explorer.

Name Description
Source Control > Source Control Manager Opens Source Control Manager, where you can track and manage changes to database schema and static data.
When Source Control Manager is already open, this option refreshes it.
Source Control > Commit Opens Source Control Manager with all local changes (if any) selected and ready to commit.
When Source Control Manager is already open, this option refreshes it and selects all local database changes.
Source Control > Get Latest Opens Source Control Manager with all remote changes (if any) selected and ready to retrieve using Get Latest.
When Source Control Manager is already open, this option refreshes it and selects all remote database changes.
Show Details Opens Object Viewer that displays object details.
Refresh Updates the object to reflect the latest changes.
Shortcut: F5

Note

The Source Control shortcut menu is available only after you link the corresponding database to a source control system.

Bulk operations

In Database Explorer, hold down Ctrl and select XML schema collections. Then right-click the selection and select the required option.

The following table describes the shortcut menu options available for multiple XML schema collections.

Name Description
Source Control > Source Control Manager Opens Source Control Manager, where you can track and manage changes to database schema and static data.
When Source Control Manager is already open, this option refreshes it.
Source Control > Commit Opens Source Control Manager with all local changes (if any) selected and ready to commit.
When Source Control Manager is already open, this option refreshes it and selects all local database changes.
Source Control > Get Latest Opens Source Control Manager with all remote changes (if any) selected and ready to retrieve using Get Latest.
When Source Control Manager is already open, this option refreshes it and selects all remote database changes.
Source Control > Link/Unlink Static Data Opens the Source Control Link Static Data dialog that displays the tables whose data you want to link.
Generate Script As Generates scripts of the selected objects using the CREATE, DROP, and DROP and CREATE statements. The scripts can be generated to a new SQL document or to a file, or copied to the clipboard.
Delete Drops the selected XML schema collections from the database.
Shortcut: Delete

Bulk operations for multiple XML schema collections