<Products ProductID="3" ProductName="Aniseed Syrup">
<Categories CategoryID="2" CategoryName="Condiments"/>
</Products>
<Products ProductID="4" ProductName="Chef Anton's Cajun Seasoning">
3.使用ELEMENTS选项
使用该选项可以生成以元素为中心的Xml表示,默认为属性方式,不过属性方式节省空间。需要注意的是使用ELEMENTS选项是一种全是或全否的形式,不能得到一部分是以元素表示而另一部分以属性表示的Xml数据。
查询语句:
SELECT CategoryID,
CategoryName
FROM Categories
WHERE CategoryID < 3
FOR XML AUTO, ELEMENTS
返回结果:
<Categories>
<CategoryID>1</CategoryID>
<CategoryName>Beverages</CategoryName>
</Categories>
<CategoryID>2</CategoryID>
<CategoryName>Condiments</CategoryName>
在连接查询时,
SELECT Categories.CategoryID,
ProductID,
ProductName
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >>
Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved. 闵涛 E_mail:admin@mintao.net(欢迎提供学习资源)
鄂公网安备 42011102001154号
站长:MinTao ICP备案号:鄂ICP备11006601号-18