If you have the Xml
stored in a Xml
column just use the value method
to shred
the Xml
.
Next time try and post some DDL, DML
to show us what you have tried, your table structures etc.
But try this
WITH XMLNAMESPACES (Default 'http://tempuri.org/smp.xsd')
SELECT
a.value('@header', 'nvarchar(50)') as Header,
b.value('local-name(.)', 'nvarchar(50)') as Sections,
b.value('@idnumber' ,'int') as IdNumber,
b.value('.' , 'nvarchar(20)') as Host
From ATable As x
Cross Apply x.AXmlColumn.nodes('Root') a(a)
Cross Apply a.nodes('Sections/*') b(b)
Here are some useful links
to get you started:
https://www.simple-talk.com/sql/learn-sql-server/the-xml-methods-in-sql-server/
http://blog.sqlauthority.com/2008/01/15/sql-server-what-is-dml-ddl-dcl-and-tcl-introduction-and-examples/
http://msdn.microsoft.com/en-us/library/ms189254.aspx