Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 4729

XML To SQL

$
0
0

I have an online ordering form that stores the data in XML (See below).  I need to put this data into SQL so that we can build work tickets using Crystal Reports.   Ideally, two tables would be created (1) order.header (2) order.details

Everything in italics would need to appear in the order.header table. Everything in Bold would need to appear in the order.details table.  

Any suggestions where we begin?

<Order id="519">
  <id>519</id>
  <dealer_id>377</dealer_id>
  <submitted>yes (2016-08-25)</submitted>
  <account_code>0022305</account_code>
  <account_name>MIKE TONSIL</account_name>
  <user>mfromo</user>
  <ordernumber>W000519</ordernumber>
  <clientname>TEST</clientname>
  <directship>true</directship>
  <orderdate>08/25/2016</orderdate>
  <PreviousOrder>NEW</PreviousOrder>
  <sample>true</sample>
  <sex>M</sex>
  <rush2week>false</rush2week>
  <rush1week>true</rush1week>
  <rushdeliverydate>08/31/2016</rushdeliverydate>
  <wishdate />
  <shipment>Overnight Early AM</shipment>
  <address>123 any street</address>
  <label>own</label>
  <city>Newark</city>
  <state>New Jersey</state>
  <zip>07105</zip>
  <firstbutton>2&amp;#188;</firstbutton>
  <buttonfront>7</buttonfront>
  <front>French</front>
  <back>Regular</back>
  <neck>17</neck>
  <waist>42</waist>
  <waist_allowance>6</waist_allowance>
  <hip>43</hip>
  <hip_allowance>6</hip_allowance>
  <chest>44</chest>
  <chest_allowance>6</chest_allowance>
  <overarm>54</overarm>
  <tail>33</tail>
  <tailstyle>squarevent</tailstyle>
  <yokedepth>4</yokedepth>
  <yokemeasurement>19</yokemeasurement>
  <leftsleeve>34</leftsleeve>
  <rightsleeve>34</rightsleeve>
  <leftsleevehalf>21</leftsleevehalf>
  <rightsleevehalf>21</rightsleevehalf>
  <sleevefit>full</sleevefit>
  <leftcuff>10</leftcuff>
  <rightcuff>10</rightcuff>
  <leftshoulder>+1</leftshoulder>
  <rightshoulder>-1</rightshoulder>
  <facing>true</facing>
  <heightfeet>4</heightfeet>
  <heightinches>4</heightinches>
  <weight>190</weight>
  <monogram>
    <first>M</first>
    <middle>D</middle>
    <last>F</last>
  </monogram>
  <shoulder>2</shoulder>
  <cuff>
    <stitchtype>edge</stitchtype>
    <lining>
      <fuse>false</fuse>
    </lining>
    <fusetype>builtup</fusetype>
  </cuff>
  <collar>
    <stitchtype>regular</stitchtype>
    <lining>
      <fuse>true</fuse>
    </lining>
    <fusetype>soft</fusetype>
  </collar>
  <custommonogram>true</custommonogram>
  <lineitems>
    <collar>
      <stay>
        <id>2</id>
        <name>Removable</name>
        <index>1</index>
      </stay>
      <option>
        <id>4</id>
        <value>H</value>
        <name>H</name>
        <type>HIDDEN BUTTON DOWN</type>
        <index>3</index>
      </option>
      <style>B32B</style>
    </collar>
    <picstitch>
      <id>9</id>
      <value>17</value>
      <name>[17] Dk Pink</name>
      <index>17</index>
    </picstitch>
    <saddlestitch>
      <name>NONE</name>
    </saddlestitch>
    <button>
      <id>55</id>
      <value>011</value>
      <name>[011] Navy</name>
      <index>11</index>
    </button>
    <buttonstitch>
      <id>45</id>
      <value>5</value>
      <name>[5] Hunter</name>
      <index>5</index>
    </buttonstitch>
    <buttonhole>
      <id>1</id>
      <value>1</value>
      <name>[1] Lime</name>
      <index>1</index>
    </buttonhole>
    <pocket>
      <id>1</id>
      <value>X</value>
      <name>No Pocket</name>
      <type>NONE</type>
    </pocket>
    <flaps>
      <id>18</id>
      <value>R</value>
      <name>Round</name>
      <type>FLAPS</type>
      <index>17</index>
    </flaps>
    <crowsfoot>
      <name>NONE</name>
    </crowsfoot>
    <checkedsample>false</checkedsample>
    <sample>true</sample>
    <fabric>6000</fabric>
    <cmt>x</cmt>
    <quantity>1</quantity>
    <tiespace>0</tiespace>
    <chkwhitecollar>true</chkwhitecollar>
    <whitecollar>7987</whitecollar>
    <sleevehalf>false</sleevehalf>
    <sleevelong>true</sleevelong>
    <cuff>
      <option>
        <id>13</id>
        <value>A</value>
        <name>Angle</name>
        <type>2 BUTTON</type>
        <index>12</index>
      </option>
    </cuff>
    <chkwhitecuff>true</chkwhitecuff>
    <whitecuff>8008</whitecuff>
    <pocketbutton>true</pocketbutton>
    <harris>11023</harris>
    <harrismodified>true</harrismodified>
    <monostyle>24</monostyle>
    <monocolor>19</monocolor>
    <monolocation>Pocket Center</monolocation>
    <tuxedo>true</tuxedo>
    <bib>9999</bib>
    <pleats>&amp;#189;</pleats>
    <studs>4</studs>
    <epaulets>true</epaulets>
    <anglebuttonholes>true</anglebuttonholes>
    <anglebuttonstack>Triple Stack</anglebuttonstack>
    <iscrowsfoot>true</iscrowsfoot>
    <ispicstitch>true</ispicstitch>
    <issaddlestitch>false</issaddlestitch>
    <sleevetabs>true</sleevetabs>
    <reversibleCC>true</reversibleCC>
  </lineitems>
  <lineitems>
    <collar>
      <stay>
        <id>2</id>
        <name>Removable</name>
        <index>1</index>
      </stay>
      <option>
        <id>4</id>
        <value>H</value>
        <name>H</name>
        <type>HIDDEN BUTTON DOWN</type>
        <index>3</index>
      </option>
      <style>B32B</style>
    </collar>
    <picstitch>
      <id>9</id>
      <value>17</value>
      <name>[17] Dk Pink</name>
      <index>17</index>
    </picstitch>
    <saddlestitch>
      <name>NONE</name>
    </saddlestitch>
    <button>
      <id>55</id>
      <value>011</value>
      <name>[011] Navy</name>
      <index>11</index>
    </button>
    <buttonstitch>
      <id>45</id>
      <value>5</value>
      <name>[5] Hunter</name>
      <index>5</index>
    </buttonstitch>
    <buttonhole>
      <id>1</id>
      <value>1</value>
      <name>[1] Lime</name>
      <index>1</index>
    </buttonhole>
    <pocket>
      <id>1</id>
      <value>X</value>
      <name>No Pocket</name>
      <type>NONE</type>
    </pocket>
    <flaps>
      <id>18</id>
      <value>R</value>
      <name>Round</name>
      <type>FLAPS</type>
      <index>17</index>
    </flaps>
    <crowsfoot>
      <name>NONE</name>
    </crowsfoot>
    <checkedsample>false</checkedsample>
    <sample>true</sample>
    <fabric>6000</fabric>
    <cmt>x</cmt>
    <quantity>1</quantity>
    <tiespace>0</tiespace>
    <chkwhitecollar>true</chkwhitecollar>
    <whitecollar>7987</whitecollar>
    <sleevehalf>false</sleevehalf>
    <sleevelong>true</sleevelong>
    <cuff>
      <option>
        <id>13</id>
        <value>A</value>
        <name>Angle</name>
        <type>2 BUTTON</type>
        <index>12</index>
      </option>
    </cuff>
    <chkwhitecuff>true</chkwhitecuff>
    <whitecuff>8008</whitecuff>
    <pocketbutton>true</pocketbutton>
    <harris>11023</harris>
    <harrismodified>true</harrismodified>
    <monostyle>24</monostyle>
    <monocolor>19</monocolor>
    <monolocation>Pocket Center</monolocation>
    <tuxedo>false</tuxedo>
    <bib>9999</bib>
    <pleats>&amp;#189;</pleats>
    <studs>4</studs>
    <epaulets>true</epaulets>
    <anglebuttonholes>true</anglebuttonholes>
    <anglebuttonstack>Triple Stack</anglebuttonstack>
    <iscrowsfoot>true</iscrowsfoot>
    <ispicstitch>true</ispicstitch>
    <issaddlestitch>false</issaddlestitch>
    <sleevetabs>true</sleevetabs>
    <reversibleCC>true</reversibleCC>
  </lineitems>
</Order>


Viewing all articles
Browse latest Browse all 4729

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>