Is an XQuery expression identifying the nodes to be deleted. All the nodes selected by the expression, and also all the nodes or values that are contained within the selected nodes, are deleted. As described in insert (XML DML), this must be a reference to an existing node in the document. It cannot be a constructed node. The expression cannot be the root (/) node. If the expression returns an empty sequence, no deletion occurs and no errors are returned.

A. Deleting nodes from a document stored in an untyped xml variable

The following example illustrates how to delete various nodes from a document. First, an XML instance is assigned to variable of xml type. Then, subsequent delete XML DML statements delete various nodes from the document.

C. Deleting nodes from a typed xml column

This example deletes nodes from a manufacturing instructions XML document stored in a typed xml column.

In the example, you first create a table (T) with a typed xml column in the AdventureWorks database. You then copy a manufacturing instructions XML instance from the Instructions column in the ProductModel table into table T and delete one or more nodes from the document.