title: How to populate an empty XML node using modify replace on an XML column?
body: <p>This is my xml stored in an XML type column called UserDef</p>
  
  <pre><code>&lt;Orders&gt;
    &lt;Document&gt;
      &lt;DocumentID&gt;abc123&lt;/DocumentID&gt;
      &lt;ActualShipDate /&gt;
      &lt;Comments/&gt;
    &lt;/Document&gt;
    &lt;Document&gt;
   ....
   ...
    &lt;/Document&gt;
  &lt;/Orders&gt;
  </code></pre>
  
  <p>I'm trying to populate the <code>Comments</code> element with this: </p>
  
  <pre><code>declare @t1 table (id bigint, userdef xml)
  
  insert into @t1
  select id, userdef from MyMainTable
  
  update @t1 
  set userdef.modify('replace value of(/Orders/Document/Comments[1]/text())[1]  with "NO COMMENTS"')
  select * from @t1   
  </code></pre>
  
  <p>However, I don't see the <code>Comments</code> being populated at all. What should I do differently in order for this to work?</p>