I need to parse the above xml such that it returns the attributes in a flat
format,
e.g. abc,123
How can this be achieved using sql 2005
You can use openxml function.
Regards, Balaji
"Anonymous" <Anon...@discussions.microsoft.com> wrote in message
news:AF7244FC-53B5-4C42...@microsoft.com...
DECLARE @xml XML
SET @xml = '<SampleXML>
<Tables>
<Table value="abc" />
<Table value="123" />
</Tables>
<Fields>
<Field value="Name" />
<Field value="Price" />
</Fields>
</SampleXML>'
SELECT
root.x.value('(Table/@value, Field/@value)[1]', 'VARCHAR(50)') AS a,
root.x.value('(Table/@value, Field/@value)[2]', 'VARCHAR(50)') AS b
FROM @xml.nodes('SampleXML/*') root(x)