XML QUERY LANGUAGES: XQUERY AND XPATH for $b in //person where $b/name= moe return

  • { string($b/name[1] }
  • ) FROM xml_tab GO returns

  • moe
  • moe
  • This query also uses the XQuery string function, which leads us to talking about XQuery standard functions. We ll talk about XQuery standard functions and operators shortly. xml.nodes(string xquery-text) The xml.nodes XML data type function produces a single column rowset from the contents of an XML data type column. This function takes an XQuery expression and produces zero or more rows that contain a single column that is an opaque reference to a special type of XML document. This reference is special because the context node for future XQuery functions is set at the node that matches the XQuery statement in the xml. nodes clause. This document must be used with other XQuery functions, like queryor value, and can even be used as input to another nodesfunction. Because xml.nodesproduces a context node other than the root node, relative XQuery/XPath expressions can be used with the resultant document reference. The xml.nodesfunction must be used in conjunction with the CROSSAPPLYor OUTERAPPLYclause of a SELECTstatement, because the table that contains the XML data type column must be part of the left-hand side of the CROSSAPPLYclause; the rowset cannot be returned directly. Here s a simple example that shows its usage. Starting with the simple XMLdata type table of people: CREATE TABLE xml_tab( the_id INTEGER PRIMARY KEY IDENTITY, xml_col XML) GO INSERT xml_tab VALUES( curly ) INSERT xml_tab VALUES( larry ) INSERT xml_tab VALUES( moe ) INSERT xml_tab values(

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

    Bookmark the permalink.

    Comments are closed.