XML QUERY LANGUAGES: XQUERY AND XPATH The

XML QUERY LANGUAGES: XQUERY AND XPATH The SELECTstatement can also refer the other columns in the xml_tabtable in this case, the the_idcolumn. You could use OUTER APPLY instead of CROSS APPLY. In this case, because all the row values contain a matching node, the result will be the same, but if we added a nameless person as follows: INSERT xml_tab VALUES( ) the CROSS APPLY version would produce five rows, and the OUTER APPLY version would produce six rows with the name as a NULL value. A similar condition doesn t distinguish between CROSS APPLY and OUTER APPLY, however. Say we look for a node in the xml.value portion (l_name) that doesn t exist in any of the noderefs. SELECT the_id, a.value( l_name[1]/text()[1] , varchar(20) ) AS l_name FROM xml_tab CROSS APPLY xml_col.nodes( /people/person/name ) AS result(a) Both CROSS APPLY and OUTER APPLY produce the same number of rows, all with NULLvalues for l_name. Although the syntax for producing the rowset may seem strange at first, this equates to the second parameter in the OpenXML function, which also produces one row for each node selected by the expression in the second parameter. You use each reference node produced by the xml.nodes function as a starting node (context node) for the XMLdata type xml.query, xml.value, or xml.nodes functions. Using the reference node with xml.existis technically possible but of limited value. These functions are used to produce additional columns in the rowset, analogous to the WITH clause in OpenXML. When used in conjunction with the XMLdata type functions, the xml.nodes function is a less memory-intensive version of OpenXML. It uses less memory because data in the XML data type column is already parsed; we get similar results to using OpenXML without the overhead of having a DOM in memory. XQuery Standard Functions and Operators The XQuery standard includes two companion specifications that describe the data model and its extension functions. These standards apply not only to XQuery, but also to XPath 2.0 and indirectly to XSLT 2.0, which uses XPath 2.0 as its query language. The first specification, XQuery 1.0 and XPath 2.0 Data Model, lays the groundwork for both specifications and

Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost PHP Web Hosting services

Bookmark the permalink.

Comments are closed.