XML string to return Table Rows

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
hi experts I have got a XML string. which i want to pass to sql to get Table Rows /Column out of it,
can some one show me how can i do this.
here is my xml
<pre class="prettyprint DECLARE @xml xml
SET @xml= <Receiptsui>
<ui>3501d989-308c-481c-8b2a-f92230d3f9bc</ui>
<ui>da832de7-b719-43bb-bfd6-e386eb6dbbda</ui>
<ui>11c26563-acb0-4aac-aabd-ef12022feae6</ui>
<ui>2e200248-8755-41e9-8be2-922422110443</ui>
<ui>e77dffa1-5be9-4671-a819-9ec77060b993</ui>
<ui>c507433b-2d05-4f8d-beb3-12bcc5fc66b2</ui>
</Receiptsui>

SELECT
T.n.value(@ui[1], uniqueidentifier) [ui]
FROM
@xml.nodes(/Receiptsui/ui) T(n)
GO[/code]
i tried above code, but it is giving null rows.


View the full article
 
Back
Top