title: "incorrect syntax near modify" while updating an xml type of column value
body: <p>I have a XML type of column called "Details" in my "table" in SQL Server 2008. The value of this column is:</p>
  
  <pre><code>&lt;output xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
    &lt;Request&gt;
      &lt;header&gt;
        &lt;message-id&gt;300_500&lt;/message-id&gt;
        &lt;userid&gt;eray&lt;/userid&gt;
        &lt;timestamp&gt;2012-01-01T12:00:0.000&lt;/timestamp&gt;
        &lt;currentstatus&gt;COMPLETED&lt;/currentstatus&gt;
      &lt;/header&gt;
      ...
    &lt;/Request&gt;
  &lt;/output&gt;
  </code></pre>
  
  <p>What I want to do is to replace the timestamp value in the xml column (details) of Table with another timestamp value from Table2 by using an update statement. This is what I am trying:</p>
  
  <pre><code>update t
  set t.Details.modify('replace value of 
      (/output/Request/header/timestamp/text())[1] with 
      ("'+t2.MessageTimestamp+'")')
  from Table t
  inner join Table2 t2 on t2.apptId = t1.apptId
  </code></pre>
  
  <p>However, it is not working and giving me the error: </p>
  
  <blockquote>
    <p>Incorrect syntax near 'modify'</p>
  </blockquote>
  
  <p>I tried to fix it for a while by reading many articles online, but could not see what is wrong here. Any help would be appreciated.</p>