declare @OrderList xml
set @OrderList = '<Order>
<Item>
<Prod ID=''60000'' Qty=''200''></Prod>
</Item>
<Item>
<Prod ID=''60180'' Qty=''1000''></Prod>
</Item>
</Order>'
select
D.element.value('@ID', 'nvarchar(255)') as ID,
D.element.value('@Qty','nvarchar(255)') as Qty
from @OrderList.nodes('/Order/Item/Prod') as D(element)
set @OrderList = '<Order>
<Item>
<Prod ID=''60000'' Qty=''200''></Prod>
</Item>
<Item>
<Prod ID=''60180'' Qty=''1000''></Prod>
</Item>
</Order>'
select
D.element.value('@ID', 'nvarchar(255)') as ID,
D.element.value('@Qty','nvarchar(255)') as Qty
from @OrderList.nodes('/Order/Item/Prod') as D(element)
No comments:
Post a Comment