title: SQL MERGE INTO - How to delete then insert matched/existing data?
body: <p>I currently have a stored procedure that compares my target table (Ticket_Report) to my data source table (New_Tickets).</p>
  
  <p>I am using  a MERGE INTO statement to compare these two. When it finds a match between the two tables, it updates the current row in the target table with the corresponding info from the source table. If it dosent find a match, it inserts that data from the source table into the target table.</p>
  
  <pre><code> MERGE INTO Ticket_REPORT T1
    USING @New_Tickets T2
    ON T1.TICKET_NO=T2.TICKET_NO
    WHEN MATCHED THEN
    UPDATE SET 
        T1.TICKET_NO = T2.TICKET_NO, 
        T1.ASSIGNED_GROUP = T2.ASSIGNED_GROUP, 
        T1.ASSIGNEE = T2.ASSIGNEE, 
        T1.FNAME = T2.FNAME, 
        T1.LNAME = T2.LNAME
  WHEN NOT MATCHED THEN
    INSERT VALUES(
        T2.TICKET_NO, 
        T2.ASSIGNED_GROUP, 
        T2.ASSIGNEE, 
        T2.FNAME, 
        T2.LNAME
   );
  </code></pre>
  
  <p>What I need to do is, when I find a MATCH, instead of just updating the row, I need to delete that row, and re-insert it into the target table.  Can anyone show me how to both DELETE and INSERT one after the other whenever I find a MATCH?</p>