Ani

Ani

  • 168
  • 11.2k
  • 34.5k

iterating xml data

Apr 13 2022 6:06 AM

In my application database, customer order information is stored as xml in a nvarchar field in sql server.
I want to extract all orders which are valued more than 1000. Please find the below sample xml and help me with the query.


Sample xml 

<customer>
<orders>
<order>
<orderdate>2022-01-01</orderdate>
<ordervalue>5000</ordervalue>
</order>
<order>
<orderdate>2022-01-21</orderdate>
<ordervalue>800</ordervalue>
</order>
<order>
<orderdate>2022-02-17</orderdate>
<ordervalue>1500</ordervalue>
</order>
<order>
<orderdate>2022-03-30</orderdate>
<ordervalue>9000</ordervalue>
</order>
</orders>
</customer>
 


Answers (2)