title: Import parent-child XML data to Sql Server Tables
body: <p>I have a XML like this:</p>
  
  <pre><code>    &lt;StateTree&gt;
        &lt;State ID="01"&gt;
          &lt;Name&gt;State1&lt;/Name&gt;
           &lt;CityList&gt;
            &lt;City ID="01" Order="1" CityGroup="1" CityBuild="1" GeoLocation="X"&gt;
              &lt;Name&gt;City1&lt;/Name&gt;
              &lt;Group&gt;1&lt;/Group&gt;
               &lt;AreaList&gt;
                &lt;Area ID="01" GeoLocation="6"&gt;
                  &lt;Name&gt;Area1&lt;/Name&gt;
                &lt;/Area&gt;
                &lt;Area ID="02" GeoLocation="6"&gt;
                  &lt;Name&gt;Area2&lt;/Name&gt;
                &lt;/Area&gt;
              &lt;/AreaList&gt;
            &lt;/City&gt;
            &lt;City ID="02" Order="3" CityGroup="2" CityBuild="4" GeoLocation="5"&gt;
              &lt;Name&gt;City2&lt;/Name&gt;
              &lt;Group&gt;2&lt;/Group&gt;
              &lt;AreaList /&gt;
            &lt;/City&gt;
          &lt;/CityList&gt;
        &lt;/State&gt;
       &lt;/StateTree&gt;
  </code></pre>
  
  <p>and I want to convert it to tables like this:</p>
  
  <p>State:</p>
  
  <pre><code>ID        Name
  01        State1
  ---------------------------------------------------
  </code></pre>
  
  <p>City:</p>
  
  <pre><code>ID    Order   CityGroup   CityBuild   GeoLocation   Name       State1
  01    1         1           1           X           City1       01
  02    3         2           4           5           City2       01
  ---------------------------------------------------
  </code></pre>
  
  <p>AreaList:</p>
  
  <pre><code>ID        GeoLocation       Name        CityID
  01          6               Area1        01
  02          6               Area2        01
  </code></pre>
  
  <p>How I can do this ?</p>
  
  <p>thanks</p>