如何在 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 属性进行排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
获取所有产品、类别和元数据的 SQL 查询 woocommSQL query to get all products, categories and meta data woocommerce/wordpress(获取所有产品、类别和元数据的 SQL 查询 woocommerce/wordpre
我可以在不编写 SQL 查询的情况下找出数据库列表Can I figure out a list of databases and the space used by SQL Server instances without writing SQL queries?(我可以在不编写 SQL 查询的情况下
如何创建对 SQL Server 实例的登录?How to create a login to a SQL Server instance?(如何创建对 SQL Server 实例的登录?)
如何通过注册表搜索知道SQL Server的版本和版本How to know the version and edition of SQL Server through registry search(如何通过注册表搜索知道SQL Server的版本和版本)
为什么会出现“数据类型转换错误"?使用 ExWhy do I get a quot;data type conversion errorquot; with ExecuteNonQuery()?(为什么会出现“数据类型转换错误?使用 ExecuteNonQuery()?)
如何将 DataGridView 中的图像显示到 PictureBox?How to show an image from a DataGridView to a PictureBox?(如何将 DataGridView 中的图像显示到 PictureBox?)