Link to home
Start Free TrialLog in
Avatar of Jim Horn
Jim HornFlag for United States of America

asked on

SQL query against XML columns

Hi All

I have a SQL 2012 table, where one of the columns is an XML data type.  Below is one of the values:
<items>
  <Counter CounterName="processed" CounterValue="70" />
  <Counter CounterName="deferred" CounterValue="1" />
  <Counter CounterName="delivered" CounterValue="70" />
  <Counter CounterName="sent" CounterValue="70" />
  <Counter CounterName="click" CounterValue="2" />
  <Counter CounterName="open" CounterValue="22" />
</items>

Open in new window

Question:  How can I write a query that displays all of the above as columns, such as ...  
SELECT 
   ??? as processed, 
   ??? as deferred, 
   ??? as delivered, --- etc. 
FROM mytable

Open in new window

Thanks in advance.
Jim
ASKER CERTIFIED SOLUTION
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial