In this Level, we’ll look at how to use XML methods within user-defined functions to return XML fragments and values from your target XML instance.
in order to use the modify() method to delete data from typed and untyped XML instances, you must pass an XML DML expression as an argument to the method. That expression must include the delete keyword, along with an XQuery expression that defines the XML component to be deleted. Robert makes it seem simple, as usual.
You need to provide the necessary keywords and define the XQuery and value expressions in your XML DML expression in order to use the modify() method to update element and attribute values in either typed or untyped XML instances in an XML column. Robert Sheldon explains how.
The modify method lets you manipulate XML data using XML DML. It can insert, alter or delete data. In this level, Robert shows how to use the method to insert a node into an XML instance.
The XML exist() method is used, often in a WHERE clause, to check the existence of an element within an XML document or fragment. The nodes() method lets you shred an XML instance and return the information as relational data.
You can enforce the validation of an XML data type, variable or column by associating it with an XML Schema Collection. SQL Server validates a typed XML value against the rules defined in the schema collection so that INSERT or UPDATE operations will succeed only if the value being inserted or updated is valid as per the rules defined in the Schema Collection.