I have written the below query to insert data from xml file to a mysql table:
load XML local infile 'D:\\a.xml' into table asdb.abc rows identified by '<ApplicantName>';
It inserts the values in the table. I have a column named AckNo in the abc
table. I need to insert the xml values where ackNo is equal to a particular value. eg i tried writing the below query but its not working:
load XML local infile 'D:\\a.xml' into table asdb.abc rows identified by '<ApplicantName>' where ackNo='1';
Would really appreciate someones help.
I don't think that you can use a WHERE
clause with LOAD INFILE
.
Check the documentation .
I think you have to parse your XML file and keep only values you want, then generates another XML file, before using LOAD DATA
.
Or easier and quicker :
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.