title: Add node to XML using TRANSACT-SQL
body: <p>I've been struggling with this simple piece of code without result. I'm just trying to add a new node to an XML variable.</p>
  
  <pre><code>DECLARE @XML XML;
  SET @XML = '&lt;root&gt;
  &lt;policyData&gt;
      &lt;txtComentario /&gt;
      &lt;idRegProducto&gt;76&lt;/idRegProducto&gt;
      &lt;txtDuracion&gt;24&lt;/txtDuracion&gt;
  &lt;/policyData&gt;
  &lt;/root&gt;';
  DECLARE @NODE XML;
  SET @NODE = '&lt;newNode&gt;10&lt;/newNode&gt;';
  SET @XML.modify
  ('insert sql:variable("@NODE") as first
  into (/root/policyData)[0]')
  SELECT @XML;
  </code></pre>
  
  <p>There is no errors, but the new node is not showing in the output. Is there something that I must setup first before using XML in SQL Server? Any suggestion why this is not working?</p>
  
  <p>Thanks in advance!</p>