Sort XML Attributes in SQL(在 SQL 中对 XML 属性进行排序)
问题描述
如何在 SQL 中对 XML 属性进行排序?
How to sort XML Attributes in SQL?
例如对于这个 XML:
for example for this XML:
<books><book b='' c='' a=''/></books>
我想要:
<books><book a='' b='' c=''/></books>
推荐答案
来自 http://msdn.microsoft.com/en-us/library/ms187107%28v=sql.90%29.aspx:
不保留 XML 属性的顺序.当您查询XML 实例存储在 xml 类型列中,属性在生成的 XML 可能与原始 XML 实例不同.
The order of the XML attributes is not preserved. When you query the XML instance stored in the xml type column, the order of attributes in the resulting XML may be different from the original XML instance.
因此,即使您能想出一种对属性进行排序的方法,您也不能相信 SQL Server 中的 XML 数据类型会保留您想要的顺序.
So even if you could figure out a way of sorting the attributes, you can not trust that the XML data type in SQL Server will preserve the order you want.
这篇关于在 SQL 中对 XML 属性进行排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 SQL 中对 XML 属性进行排序
基础教程推荐
- 无法解决整理冲突 2021-01-01
- SQL 效率:WHERE IN 子查询 vs. JOIN 然后 GROUP 2021-01-01
- SSMS 中的权限问题:“对象 'extended_properties'、数据库 'mssqlsystem_resource'、... 错误 229)上的 SELECT 权限被拒绝" 2022-01-01
- 如何使用 mysql.connector 禁用查询缓存 2022-01-01
- SQL Server 实例在登录协商期间返回无效或不受支持的协议版本 2021-01-01
- SQL:使用来自具有相同列名的两个表中的数据... 2021-01-01
- 需要 MySQL 5.1 中的抽象触发器来更新审计日志 2021-01-01
- 将 SQL Server DateTime 列迁移到 DateTimeOffset 2021-01-01
- 是否可以执行按位分组功能? 2021-01-01
- 在 SQL 中连接多个表 2021-01-01
