title: Extracting a value from a XML column in SQL Server 2012
body: <p>I have seen many questions addressing this issue, but unfortunately I still was not able to make it work.</p>
  
  <p>Here's an example of the XML data contained in an XML column called <code>RentalValueAmount</code> in a table called <code>Units</code>:</p>
  
  <pre><code>&lt;X C="1" I="0"&gt;
    &lt;E D="1000Y0M0W0D" P="1" A="36500" /&gt;
  &lt;/X&gt;
  </code></pre>
  
  <p>I tried this but did not get any values:</p>
  
  <pre><code>select 
      cast(RentalValueAmount as XML).value('data(/X/E)[1]','varchar(10)') as test
  from dbo.units
  </code></pre>
  
  <p>I need to extract or return 36500 as a number using a query but I have not been able to do so.  Obviously I do not know XML, so I would really appreciate the help.</p>