XML Data Modification Language (XML DML)

**APPLIES TO:** ![yes](media/yes.png)SQL Server (starting with 2008) ![no](media/no.png)Azure SQL Database ![no](media/no.png)Azure SQL Data Warehouse ![no](media/no.png)Parallel Data Warehouse

The XML Data Modification Language (XML DML) is an extension of the XQuery language. As defined by W3C, the XQuery language lacks the Data Manipulation (DML) part. The XML DML introduced in this topic, and also the XQuery language, provides a fully functional query and data-modification language that you can use against the xml data type.

The XML DML adds the following case-sensitive keywords to XQuery:

As described in XML Data Type and Columns (SQL Server), you can create variables and columns of the xml type and assign XML documents or fragments to them. To modify or update these XML instances, do the following:

Note that there are some attributes that cannot be inserted, deleted, or have their value modified. For example:

Other restrictions include the following:

When you modify a typed XML instance, the final format must be a valid instance of that type. Otherwise, a validation error is returned.

See Also

insert (XML DML)
delete (XML DML)
replace value of (XML DML)
Compare Typed XML to Untyped XML
Create Instances of XML Data
xml Data Type Methods