title: SQL Server: how to delete xml node by sql variable?
body: <p>My first question on Stack Overflow :)</p>
  
  <p>I have XML:</p>
  
  <pre><code>DECLARE @xml XML = '&lt;root&gt;&lt;tag1 /&gt;&lt;tag2 /&gt;&lt;/root&gt;';
  </code></pre>
  
  <p>I need to remove node, but, path to node is variable "@path". </p>
  
  <pre><code>DECLARE @path XML = '/root/tag2';
  </code></pre>
  
  <p>My query is:</p>
  
  <pre><code>SET @xml.[modify]('delete sql:variable("@path")');
  </code></pre>
  
  <p>But, I get error:
  <em>Msg 9342, Level 16, State 1, Line 9
  XQuery [modify()]: An XML instance is only supported as the direct source of an insert using sql:column/sql:variable.</em></p>
  
  <p>So my question is: <strong>how can I delete xml node by sql parameter?</strong></p>