Note that there are some explanatory texts on larger screens.

plurals
  1. POLooking for a good Bulk Insert XML Shredding example for SQL 2005
    text
    copied!<p>A little help needed. I'm receiving an xml file similar to this:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-16"?&gt; &lt;dc:GRANTEE xsi:schemaLocation="http://www.blahblahblah.com/FullSchema test.xsd " xmlns:dc="http://www.blahblahblah.com/FullSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt; &lt;RPGID&gt;90CU0024&lt;/RPGID&gt; &lt;PLANID&gt;01&lt;/PLANID&gt; &lt;CASE&gt; &lt;CASEID&gt;100001&lt;/CASEID&gt; &lt;RPGID&gt;90CU0024&lt;/RPGID&gt; &lt;FILE_O&gt;2008-02-08T00:00:00&lt;/FILE_O&gt; &lt;ADULT&gt; &lt;ADULTID&gt;100001A1&lt;/ADULTID&gt; &lt;CASEID&gt;100001&lt;/CASEID&gt; &lt;APRIMARY&gt;1&lt;/APRIMARY&gt; &lt;ARLTNSHP&gt;BM&lt;/ARLTNSHP&gt; &lt;ADOB&gt;1978-12-03T00:00:00&lt;/ADOB&gt; &lt;ARACAI&gt;1&lt;/ARACAI&gt; &lt;ASEX&gt;2&lt;/ASEX&gt; &lt;SATX&gt; &lt;SATXID&gt;MD2120378&lt;/SATXID&gt; &lt;ADULTID&gt;100001A1&lt;/ADULTID&gt; &lt;SAASSESS&gt;2008-02-22T00:00:00&lt;/SAASSESS&gt; &lt;PUBPRVTX&gt;1&lt;/PUBPRVTX&gt; &lt;TXADMIT&gt;2008-02-23T00:00:00&lt;/TXADMIT&gt; &lt;TXSET&gt;5&lt;/TXSET&gt; &lt;/SATX&gt; &lt;/ADULT&gt; &lt;CHILD&gt; &lt;CHILDID&gt;100001C1&lt;/CHILDID&gt; &lt;CASEID&gt;100001&lt;/CASEID&gt; &lt;CINDEX&gt;1&lt;/CINDEX&gt; &lt;CHBDATE&gt;2008-02-05T00:00:00&lt;/CHBDATE&gt; &lt;CHSEX&gt;1&lt;/CHSEX&gt; &lt;CHRACAI&gt;0&lt;/CHRACAI&gt; &lt;MALTX&gt; &lt;MALTXID&gt;10000023&lt;/MALTXID&gt; &lt;CHILDID&gt;100001C1&lt;/CHILDID&gt; &lt;RPTDT&gt;2008-02-05T00:00:00&lt;/RPTDT&gt; &lt;CHMAL1&gt;2&lt;/CHMAL1&gt; &lt;/MALTX&gt; &lt;/CHILD&gt; &lt;/CASE&gt; </code></pre> <p></p> <p>What I need to do is import it and shred it to tables with a stored proc. I've been unable to find anything other than general regurgitation of the examples in the books online, uh, online. what I need is a little syntax walk-through that shows how I can bulk insert the file (using OPENROWSET?) and then take all of the data and split it to matching tables while maintaining keys. It seems like it should be easy, but the reference material is just hard to come by. I also have access to schema if I need that and can annotate as well.</p> <p>Anybody have a good reference?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload