title: How to run SQL and return nice XML in DB2
body: <p>I am trying to make a SQL query in a way that it returns nice XML. I was able to do something like this:</p>
  
  <pre><code>Select REC2XML(1.0, 'COLATTVAL_XML', '', A, B, C) From (select A, B, C from MY_TABLE where X = '1');
  </code></pre>
  
  <p>However, the result looks like this</p>
  
  <pre><code>&lt;row&gt;
  &lt;column name="A"&gt;1&lt;/column&gt;
  &lt;column name="B"&gt;2&lt;/column&gt;
  &lt;column name="C"&gt;3&lt;/column&gt;
  &lt;/row&gt;
  </code></pre>
  
  <p>While we would like it to have the actual column names as the element name, something like this:</p>
  
  <pre><code>&lt;row&gt;
  &lt;A&gt;1&lt;/A&gt;
  &lt;B&gt;2&lt;/B&gt;
  &lt;C&gt;3&lt;/C&gt;
  &lt;/row&gt;
  </code></pre>
  
  <p>Any ideas?</p>