How to sort XML Attributes in SQL?
for example for this XML:
<books><book b='' c='' a=''/></books>
I want:
<books><book a='' b='' c=''/></books>
From http://msdn.microsoft.com/en-us/library/ms187107%28v=sql.90%29.aspx:
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.
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.
1.4m articles
1.4m replys
5 comments
57.0k users