title: How to decode &amp; etc using XQuery/SQL?
body: <p>Using Microsoft SQL Server...</p>
  
  <pre><code>declare @x xml
  set @x = '&lt;Example&gt;&amp;lt;You &amp;amp; Me&amp;gt;&lt;/Example&gt;'
  select cast(@x.query('/Example/text()') as nvarchar(50))
  </code></pre>
  
  <p>The result is "&amp;lt;You &amp;amp; Me&amp;gt;" rather than "&lt;You &amp; Me&gt;".</p>
  
  <p>How can I have SQL read the XML in such as way that '&amp;lt;', '&amp;amp;' and '&amp;gt;' are decoded?</p>