title: Issue with MERGE statement - error in semicolon (SQL Server 2008)
body: <p>I have done everything i know about MERGE in this fiddle but am not getting output.Hope someone will come up with a solution for this. </p>
  
  <p>I have done a simple MERGE statement to insert, update and delete the values of target table using source table  at the same time  and everything is fine but am getting error message saying </p>
  
  <p><img src="https://i.stack.imgur.com/yjuBf.png" alt="Error - A MERGE statement must be terminated by a semi-colon (;)"></p>
  
  <p>I have put semi-colon but the error keeps popping up.I am studying MERGE statements and how to use them using two table using SQLFiddle and someone please show me the correct approach to place the semi-colon. </p>
  
  <p>Here's the fiddle - <a href="http://sqlfiddle.com/#!3/bf3dd/20" rel="nofollow noreferrer">SQLFiddle</a></p>
  
  <p>and here's the code of MERGE</p>
  
  <pre><code>MERGE Students AS T 
  
  USING Teachers AS S
  ON S.LastName = T. LastName and
  S.FirstName = T.FirstName
  
  WHEN MATCHED THEN
  UPDATE SET T.Address = S.Address,
           T.Age = S.Age 
  
  WHEN NOT MATCHED THEN
  INSERT (LastName, 
        FirstName, 
        Address, 
        Age) 
        VALUES (S.LastName, 
        S.FirstName, 
        S.Address, 
        S.Age)
  
  WHEN NOT MATCHED BY SOURCE THEN 
  DELETE;
  
  OUTPUT $action, Inserted.LastName, Inserted.FirstName, Deleted.LastName, Deleted.FirstName INTO @T;
  
  Select * from @T;
  </code></pre>