MySQL Forums
Forum List  »  Connector/Node.js

Re: Loading XML file in Mysql 5.0
Posted by: Harald Groven
Date: April 27, 2008 06:17PM

Assuming your file is on the Windows desktop, and if there are 3 newlines between each new xml entity you want to store as a record, the following query will work:


LOAD DATA LOCAL INFILE 'C:\\Documents and Settings\\mylogon\\Desktop\\report.xml'
INTO TABLE mytable
FIELDS TERMINATED BY '\n\n\n'
LINES TERMINATED BY '\n\n\n'
;

If newlines cannot be used as a separator, you may choose any thing else that work. E.g. do a search/replace where you replace "<starttag" with "ZZZ<starttag" and then use FIELDS TERMINATED BY 'ZZZ' LINES TERMINATED BY 'ZZZ'

Options: ReplyQuote


Subject
Written By
Posted
Re: Loading XML file in Mysql 5.0
April 27, 2008 06:17PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.