Select records from XML column (SQL Server 2005) based on node order

Posted by jdoe on Stack Overflow See other posts from Stack Overflow or by jdoe
Published on 2009-02-23T14:55:42Z Indexed on 2010/04/10 11:03 UTC
Read the original article Hit count: 221

Filed under:
|
|

I have a column in a SQL Server 2005 table defined as an XML column. Is there a way to select records from this table based on the order of two nodes in that column? For example, we have the following structure in our XML:

<item>
   <latitude/>
   <longitude/>
</item>

I want to see if there are any records that have latitude/longitude in the opposite order i.e. <longitude/> then <latitude/>. I've tried some XPath expressions but with no luck.

© Stack Overflow or respective owner

Related posts about sql-server-2005

Related posts about Xml