title: Convert nested XML via XQuery to flat xml
body: <p>I've a nested piece of XML i want to insert in to SQL. </p>
  
  <p>Import XML:</p>
  
  <pre><code> &lt;RECORD&gt;
      &lt;RECID&gt;118810&lt;/RECID&gt;
      &lt;FIELD TYPE="C"&gt;
         &lt;NAME&gt;proj_code&lt;/NAME&gt;
         &lt;VALUE&gt;118810&lt;/VALUE&gt;
      &lt;/FIELD&gt;
      &lt;FIELD TYPE="C"&gt;
         &lt;NAME&gt;sub_nr&lt;/NAME&gt;
         &lt;VALUE&gt;99900&lt;/VALUE&gt;
      &lt;/FIELD&gt;
      &lt;FIELD TYPE="C"&gt;
         &lt;NAME&gt;proj_desc&lt;/NAME&gt;
         &lt;VALUE&gt;Nagekomen kosten Oktober 2018&lt;/VALUE&gt;
      &lt;/FIELD&gt;
      &lt;FIELD TYPE="N"&gt;
         &lt;NAME&gt;pro_stat&lt;/NAME&gt;
         &lt;VALUE&gt;9&lt;/VALUE&gt;
      &lt;/FIELD&gt;
      &lt;FIELD TYPE="C"&gt;
         &lt;NAME&gt;comment&lt;/NAME&gt;
         &lt;VALUE&gt;&lt;/VALUE&gt;
      &lt;/FIELD&gt;
  &lt;/RECORD&gt;
  </code></pre>
  
  <p>I want to convert via XQuery it into:</p>
  
  <pre><code>&lt;RECORD&gt;
      &lt;RECID&gt;118810&lt;/RECID&gt;
      &lt;proj_code&gt;118810&lt;/proj_code&gt;
      &lt;sub_nr&gt;99900&lt;/sub_nr&gt;
      &lt;proj_desc&gt;Nagekomen kosten Oktober 2018&lt;/proj_desc&gt;
      &lt;pro_stat&gt;9&lt;/pro_stat&gt;
      &lt;comment&gt;&lt;/comment&gt;
  &lt;/RECORD&gt;
  </code></pre>
  
  <p>so i can import it into SQL. </p>
  
  <p>Any thoughts? </p>