Skip to content

Latest commit

 

History

History
76 lines (57 loc) · 3.35 KB

File metadata and controls

76 lines (57 loc) · 3.35 KB
title XML Data Modification Language (XML DML) | Microsoft Docs
ms.custom
ms.date 03/16/2017
ms.prod sql
ms.prod_service sql-database
ms.service
ms.component t-sql|xml
ms.reviewer
ms.suite sql
ms.technology
database-engine
ms.tgt_pltfrm
ms.topic language-reference
dev_langs
TSQL
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
ms.assetid 20ce50d2-c07b-4e41-93a7-1380d2cd49cb
caps.latest.revision 29
author douglaslMS
ms.author douglasl
manager craigg
ms.workload On Demand

XML Data Modification Language (XML DML)

[!INCLUDEtsql-appliesto-ss2008-xxxx-xxxx-xxx-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), 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:

  • 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)
delete (XML DML)
replace value of (XML DML)
Compare Typed XML to Untyped XML
Create Instances of XML Data
xml Data Type Methods