Guest User

Guest User

  • Tech Writer
  • 2.1k
  • 474.5k

converting xml data into sql query

Nov 2 2023 7:54 AM

Hi Team

I need someone who can show how to convert xml data into sql query. Below is my xml data.

<SalesOrder>
<OrderHeader>
<OrderNumber>SO625144</OrderNumber>
<OrderType>Normal</ OrderType>
<OrderStatus>New</ OrderStatus>
<CustomerName>KFC</ CustomerName>
<CreateDate>2018-03-08 13:52:21</ CreateDate>
</OrderHeader>
<OrderLine>
<LineNumber>1</ LineNumber>
<ProductCode>GSX837420</ ProductCode>
<ProductType>Parts</ ProductType>
<CostPrice>13.54</ CostPrice>
<SalesPrice>84.49</ SalesPrice>
<Quantity>10</ Quantity>
</ OrderLine>
<OrderLine>
<LineNumber>2</ LineNumber>
<ProductCode>AVF697420</ ProductCode>
<ProductType>Apparel</ ProductType>
<CostPrice>19.34</ CostPrice>
<SalesPrice>105.99</ SalesPrice>
<Quantity>25</ Quantity>
</ OrderLine>
</SalesOrder>
<SalesOrder>
<OrderHeader>
<OrderNumber>SO625145</OrderNumber>
<OrderType>Normal</ OrderType>
<OrderStatus>New</ OrderStatus>
<CustomerName>Nandos</ CustomerName>
<CreateDate>2018-03-09 08:56:21</ CreateDate>
</OrderHeader>
<OrderLine>
<LineNumber>1</ LineNumber>
<ProductCode>YTS786663</ ProductCode>
<ProductType>Parts</ ProductType>
<CostPrice>8.44</ CostPrice>
<SalesPrice>49.22</ SalesPrice>
<Quantity>2</ Quantity>
</ OrderLine>
<OrderLine>
<LineNumber>2</ LineNumber>
<ProductCode>UYT485911</ ProductCode>
<ProductType>Equipment</ ProductType>
<CostPrice>41.57</ CostPrice>
<SalesPrice>250.45</ SalesPrice>
<Quantity>12</ Quantity>
</ OrderLine>
<OrderLine>
<LineNumber>3</ LineNumber>
<ProductCode>PLO879996</ ProductCode>
<ProductType>Apparel</ ProductType>
<CostPrice>21.57</ CostPrice>
<SalesPrice>65.45</ SalesPrice>
<Quantity>8</ Quantity>
</ OrderLine>
</SalesOrder>

 


Answers (4)