Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 OpenXML vs BulkLoader vs Plain old parsing

Author  Topic 

toot
Starting Member

2 Posts

Posted - 2003-04-29 : 16:46:31
Hey,
I'm trying to work out host to parse a complex xml document and chuck it in a db.

The schema which defines for example a complex type Address with many child nodes and attributes.

The Address type is then used in various places in the xml doc, eg
Delivery, Billing, etc.

As far as i can work out, OpenXML can't handle this situation, nor can the BulkLoader, so does mean that i have to Parse it by hand, or am i missing something?

You help is appreciated.
Cheers,
Chris

robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-04-29 : 20:16:49
One option to consider is to use XSL/XSLT to transform the XML into a flat-text format that you can import into SQL Server using bcp, BULK INSERT, or DTS. This could very likely be the fastest method, and probably more flexible than OPENXML because the XSL template files do all the work, and are totally portable. It also lets you import the XML data into earlier versions of SQL Server (and other products) that don't support XML directly.

You'd probably need one XSL template for each database table you'd insert into, and you'd have to insert the referenced (parent) tables before inserting the referencing (child) tables.

Go to Top of Page
   

- Advertisement -