Hi Team
I need someone who can show how to convert xml data into sql query. Below is my xml data.
HTML / XML
SO625144
Normal
New
KFC
2018-03-08 13:52:21
1
GSX837420
Parts
13.54
84.49
10
2
AVF697420
Apparel
19.34
105.99
25
SO625145
Normal
New
Nandos
2018-03-09 08:56:21
1
YTS786663
Parts
8.44
49.22
2
2
UYT485911
Equipment
41.57
250.45
12
3
PLO879996
Apparel
21.57
65.45
8
Jignesh KumarRank #91 · 22.9K reputationPosted Nov 2, 2023, 6:16 AM EDT
Hello,
Please refer this link : https://tableconvert.com/xml-to-sql
You can use this query,
-- Insert SalesOrder data INSERT INTO SalesOrder (OrderNumber, OrderType, OrderStatus, CustomerName, CreateDate) VALUES ('SO625144', 'Normal', 'New', 'KFC', '2018-03-08 13:52:21'); INSERT INTO SalesOrder (OrderNumber, OrderType, OrderStatus, CustomerName, CreateDate) VALUES ('SO625145', 'Normal', 'New', 'Nandos', '2018-03-09 08:56:21'); -- Insert OrderLine data for SO625144 INSERT INTO OrderLine (OrderNumber, LineNumber, ProductCode, ProductType, CostPrice, SalesPrice, Quantity) VALUES ('SO625144', 1, 'GSX837420', 'Parts', 13.54, 84.49, 10); INSERT INTO OrderLine (OrderNumber, LineNumber, ProductCode, ProductType, CostPrice, SalesPrice, Quantity) VALUES ('SO625144', 2, 'AVF697420', 'Apparel', 19.34, 105.99, 25); -- Insert OrderLine data for SO625145 INSERT INTO OrderLine (OrderNumber, LineNumber, ProductCode, ProductType, CostPrice, SalesPrice, Quantity) VALUES ('SO625145', 1, 'YTS786663', 'Parts', 8.44, 49.22, 2); INSERT INTO OrderLine (OrderNumber, LineNumber, ProductCode, ProductType, CostPrice, SalesPrice, Quantity) VALUES ('SO625145', 2, 'UYT485911', 'Equipment', 41.57, 250.45, 12); INSERT INTO OrderLine (OrderNumber, LineNumber, ProductCode, ProductType, CostPrice, SalesPrice, Quantity) VALUES ('SO625145', 3, 'PLO879996', 'Apparel', 21.57, 65.45, 8);Mahesh ChandRank #1 · 393.2K reputationPosted Nov 2, 2023, 3:56 PM EDT
What exactly are you trying to do with this XML?
Muzaffar Ur RahmanRank #608 · 3.9K reputationPosted Nov 2, 2023, 5:53 AM EDT
Could you please refer below aritel to convert xml data into sql query.
https://docs.devart.com/data-pump/importing-data/import-from-xml.html
Guest UserRank #877 · 2.5K reputationPosted Nov 2, 2023, 8:09 PM EDT
Hi All
Mahesh this xml data needs to first be written in sql query so can fetch using entity framework to the project.