How to insert data form Xml into database

  • Thread starter Thread starter ad
  • Start date Start date
A

ad

I have a xml files, there are many record in it.
Can I insert these record into database at once, or I need to insert it
record by record?
 
ad,

If you are inserting the data into SQL-Server, I recommend passing fragments
of the XML to a sproc and using SELECT INTO table FROM OPENXML(@xml) syntax.
However, I would suggest breaking a large XML documenent into smaller
fragments no larger than 10,000 rows per sproc call.

For any other database, the answer is no. You must iterate over the rows in
the XML file and build an INSERT statement for each row.

Hope this helps
Ad.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top