text、ntext)。该命令只能与 hide 一起使用。当使用该命令时,不应指定AttributeName。 2.简单查询 在指定数据所在的元素的名称和标记时必须使用ElementName参数和Tag参数,也就是查询语句中表中存在的每一个实际的数据列都必须以ElementName!Tag开头。在没有指定AttributeName!Directive的情况下以元素值的形式返回。在只查询一个表的情况下Tag为1,Parent为NULL。 使用EXPLICIT模式来查询数据我认为使用倒推的方式会比较方便一些,比如我要得到如下结构, <Category ID=CategoryID Name=CategoryName>Description</Category> 查询语句: SELECT 1 AS Tag,NULL AS Parent, CategoryID AS [Category!1!ID], CategoryName AS [Category!1!Name], Description AS [Category!1] FROM Categories WHERE categoryID > 6 FOR XML EXPLICIT 返回结果: <Category ID="7" Name="Produce">Dried fruit and bean curd</Category> <Category ID="8" Name="Seafood">Seaweed and fish</Category> 当然下面的语句同上面的等效,
<< 上一页 [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] ... 下一页 >> |