I currently have several rows (say around 100 for args sake) in a table, and within that table I have an XML field which contains data as follows (example):
<cf1>summer</cf1>
.. I might then have another row or rows containing:
<cf1>winter</cf1>
.. and for completeness, another few rows perhaps containing multiples of:
<cf1>spring</cf1>
So my question is:
How to write a query/proc to return me a unique resultset of all possible xml nodes in my xml field?
I guess I can return say 100 rows, and then using C# to filter that down.. but I am guessing that with SQL 2008 there are far better ways of doing that!
The idea is that you use XQuery to grab the data in a subquery and just treat it as another row in the table. Like such:
This query will return: