本文介紹了在 SQL 中對 XML 屬性進行排序的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
限時送ChatGPT賬號..
如何在 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 數(shù)據(jù)類型會保留您想要的順序.
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模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權益,請聯(lián)系我們刪除處理,感謝您的支持!