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.
 
Back
Top