title: How to delete from source using MERGE command in SQL Server 2008?
body: <p>I am currently using the below merge code to migrate date from source to target. I have a new requirement to extend the below code to delete the record from source once an update/insert is performed on the target. Is this possible using merge(all the examples i see on the net had performing del/insert/update in the target not on the source)</p>
  
  <pre><code>    MERGE Target1 AS T
  USING Source1 AS S
  ON (T.EmployeeID = S.EmployeeID) 
  WHEN NOT MATCHED BY TARGET AND S.EmployeeName LIKE 'S%' 
      THEN INSERT(EmployeeID, EmployeeName) VALUES(S.EmployeeID, S.EmployeeName)
  WHEN MATCHED 
      THEN UPDATE SET T.EmployeeName = S.EmployeeName
  WHEN NOT MATCHED BY SOURCE AND T.EmployeeName LIKE 'S%'
      THEN DELETE  ;
  </code></pre>