tailieunhanh - Hướng dẫn học Microsoft SQL Server 2008 part 52

Tham khảo tài liệu 'hướng dẫn học microsoft sql server 2008 part 52', công nghệ thông tin, cơ sở dữ liệu phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Part III Beyond Relational Orders xmlns http orders Order CustomerID 1 SO1O1 Order Order CustomerID 1 SO1O2 Order Orders The following example demonstrates how to generate elements with multiple namespaces WITH XMLNAMESPACES http customers AS cust http orders AS ord SELECT OrderNumber AS ord OrderNumber CustomerID AS cust CustomerID FROM OrderHeader WHERE OrderlD 1 FOR XML PATH ROOT Orders Orders xmlns ord http orders xmlns cust http customers ord OrderNumber SO1O1 ord OrderNumber cust CustomerID 1 cust CustomerID Orders An element can be associated with a namespace by specifying a colonized name as the element name a name that contains a namespace name and element name separated by a colon . WITH XMLNAMESPACES offers a very easy way to generate XML output with namespace declarations. XML documents can be created with one or more namespace declarations. Understanding XQuery and FLWOR operations XQuery is a W3C recommended language created for querying XML documents. In a simplified sense one could say that XQuery is to XML what SQL is to a relational database. The query method of the XML data type implements a subset of XQuery specifications and provides a very extensive set of functionalities that enables performing a number of interesting operations on XML documents. Simple queries The basic usage of the query method is to retrieve one or more XML nodes from the given XML document. The result of the query method is always an XML data type value SELECT Order Item FROM OrderXML 472 Manipulating XML Data 18 Item ItemNumber D001 Quantity 1 Price 900 Item ItemNumber Z001 Quantity 1 Price 200 Item ItemNumber D001 Quantity 1 Price 900 The query method takes an XQuery expression that can be customized to locate and retrieve specific nodes matching a given condition SELECT Order Item @ItemNumber D001 FROM .