XML QUERY LANGUAGES: XQUERY AND XPATH with Expression2 Expression1 must return a single node; if a sequence of zero nodes or multiple nodes is returned, an error is produced. Note that, again, this is unlike a SQL searched UPDATE statement in SQL, where returning zero rows to update is not an error. It is more similar to UPDATEWHERECURRENT OF in SQL when using a cursor. Expression1 is used to find the current node. Expression2 must be a sequence of atomic values. If it returns nodes, they are atomized. The sequence in Expression2 completely replaces the node in Expression1. Here s an example that updates the CustomerName element s textchild element from Jane Smith to John Smith . SET @x.modify( update value of /Invoice/CustomerName/text() to John Smith ) General Conclusions and Best Practices XML DML can be used to update portions of an XML data instance in place. The insert, update, and delete can be composed as part of a transaction. This is a unique ability for XML; although XML is often compared to databases and complex types, the usual pattern was to retrieve the XML, update the corresponding XML DOM (or in .NET, XPathNavigator), and then write the entire document back to the file system. XML DML treats XML more like a complex type or a database and as similar to functionality found in XML-specific databases. There are a few general rules to remember when using XML DML. The nodes referenced by modify operations must be nodes in the original document. XML DML is not analogous to SQL DML. Although insertand deleteare similar, position is all important. For SQL programmers, it is the equivalent of using an updateable cursor. The resulting XML document or fragment cannot be malformed, or the xml.modifyoperation will fail. If the XML instance is validated by an XML schema, the xml.modify operation cannot interfere with schema validation.
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Adult Web Hosting services