--- title: XML Data Modification Language (XML DML) description: "XML Data Modification Language (XML DML)" author: MikeRayMSFT ms.author: mikeray ms.date: "03/16/2017" ms.service: sql ms.subservice: t-sql ms.topic: reference helpviewer_keywords: - "modifying data [SQL Server], XML DML" - "XML [SQL Server], DML" - "XML DML [SQL Server]" - "data modification language [XML DML]" - "data modifications [XML DML]" - "DML [XML in SQL Server]" - "XQuery, XML DML" - "xml data type [SQL Server], XML DML" dev_langs: - "TSQL" --- # XML Data Modification Language (XML DML) [!INCLUDE [SQL Server Azure SQL Database Azure SQL Managed Instance](../../includes/applies-to-version/sql-asdb-asdbmi.md)] 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: - **insert** - **delete** - **replace value of** As described in [XML Data Type and Columns (SQL Server)](../../relational-databases/xml/xml-data-type-and-columns-sql-server.md), 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: - Use the [modify() Method xml Data Type)](../../t-sql/xml/modify-method-xml-data-type.md) of the **xml** data type. - Specify the appropriate XML DML statements inside the **modify()** method. Note that there are some attributes that cannot be inserted, deleted, or have their value modified. For example: - For typed or untyped **xml,** the attributes are **xmlns**, **xmlns:\***, and **xml:base**. - For typed **xml** only, the attributes are **xsi:nil**, and **xsi:type**. Other restrictions include the following: - For typed or untyped **xml**, inserting the attribute **xml:base** will fail. - For typed **xml**, deleting and modifying the **xsi:nil** attribute will fail. For untyped **xml**, you can delete the attribute or modify its value. - For typed **xml**, modifying the value of the **xs:type** attribute will fail. For untyped **xml**, you can modify the attribute value. 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)](../../t-sql/xml/insert-xml-dml.md) [delete (XML DML)](../../t-sql/xml/delete-xml-dml.md) [replace value of (XML DML)](../../t-sql/xml/replace-value-of-xml-dml.md) [Compare Typed XML to Untyped XML](../../relational-databases/xml/compare-typed-xml-to-untyped-xml.md) [Create Instances of XML Data](../../relational-databases/xml/create-instances-of-xml-data.md) [xml Data Type Methods](../../t-sql/xml/xml-data-type-methods.md)