title: An action of type 'INSERT' is not allowed in the 'WHEN MATCHED' clause of a MERGE statement
body: <p>I want to perform a "soft delete". I.e. insert a new entry when matched and when not matched just insert an entry.</p>
  
  <p>For example:    </p>
  
  <pre><code>MERGE TargetTable AS targetT 
  USING SourceTable AS sourceT ON sourceT.Npi = targetT.Npi
  WHEN MATCHED AND IsNull(targetT.SPI, '') &lt;&gt; '' THEN
      UPDATE SET targetT.Isdelete = 1 --Update Only One Column
      --And also insert a new row
  WHEN NOT MATCHED 
      --Perform insert operation 
  </code></pre>