正在加载图片...
電子工業出版社 JEUISHING HOUSE DF ELECTRONCS INDSTR 【例145】AUTO模式查询 在查询分析器,执行下列查询: CT Customers. Customer ID, Orders. Order ID, Orders. OrderDate WHERE Customers. Customer ID= Orders. CustomerID and Customers. country= UK ORDER BY Customers. Customer ID FOR XML AUTO 得到下列结果(部分) <Customers Cus tomer ID= arout> <Orders OrderID="10864 OrderDate=1998-02-02T00: 00: 00/> < Orders OrderId="10920"0 deraTe="1998-03-03100:00:00"/ <Orders OrderID=10953" OrderDate=1998-03-16T00: 00: 00/> <Orders OrderID=11016 OrderDate=1998-04-10T00: 00: 000/> <Orders OrderID=10726 OrderDate=1997-11-03T00: 00: 00/> </Customers> 【例146】RAW模式查询 在查询分析器执行下列查询 SELECT Customers. CustomerId, Orders. Order id, Orders. OrderDate FROM Customers. Orders WHERE Customers. Customer ID Orders Cus tomerID and Customers. country="UK ORDER BY Customers. Customer Id FOR XML RAW 得到下列结果(部分) <row CustomerID=AROUT"OrderID=10864 Order Date=1998-02-02T00: 00: 00p <row CustomerID="AROUT"OrderID=10920"Order Date="1998-03-03T00: 00: 00"p <row CustomerID="AROUT" OrderID=10953"Order Date=1998-03-16T00: 00: 00"p> <row CustomerID="AROUt"OrderID=110 100: 00: 00"p> 例如:生成下列一个通用表 Parent Customer! 1 CustomerId OrderId ALFKI ALFKI 10643 【例147】 EXPLICIT模式查询【例 14.5】 AUTO 模式查询 在查询分析器, 执行下列查询: SELECT Customers.CustomerID, Orders.OrderID, Orders.OrderDate FROM Customers, Orders WHERE Customers.CustomerID = Orders.CustomerID and Customers.country='UK' ORDER BY Customers.CustomerID FOR XML AUTO 得到下列结果(部分): <Customers CustomerID="AROUT"> <Orders OrderID="10864" OrderDate="1998-02-02T00:00:00"/> <Orders OrderID="10920" OrderDate="1998-03-03T00:00:00"/> <Orders OrderID="10953" OrderDate="1998-03-16T00:00:00"/> <Orders OrderID="11016" OrderDate="1998-04-10T00:00:00"0"/> <Orders OrderID="10726" OrderDate="1997-11-03T00:00:00"/> </Customers> 【例 14.6】 RAW 模式查询 在查询分析器,执行下列查询: SELECT Customers.CustomerID, Orders.OrderID, Orders.OrderDate FROM Customers, Orders WHERE Customers.CustomerID = Orders.CustomerID and Customers.country='UK' ORDER BY Customers.CustomerID FOR XML RAW 得到下列结果(部分): <row CustomerID="AROUT" OrderID="10864" OrderDate="1998-02-02T00:00:00"/> <row CustomerID="AROUT" OrderID="10920" OrderDate="1998-03-03T00:00:00"/> <row CustomerID="AROUT" OrderID="10953" OrderDate="1998-03-16T00:00:00"/> <row CustomerID="AROUT" OrderID="110100:00:00"/> 例如:生成下列一个通用表: Tag Parent Customer!1! CustomerID Order!2! OrderID 1 Null ALFKI Null 2 1 ALFKI 10643 …….. ……. …….. ……… 【例 14.7】 EXPLICIT 模式查询
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有