title: How to create a trigger that copies into another table the original and edited data from a table?
body: <p>I am using SQL Server and i am wondering if there is a way to create a trigger on a table which allows to copy its original data before an update and also copy its modified data after the update in another table?</p>
  
  <p>If yes, how could i make the difference between both?</p>
  
  <p>Thanks :)</p>
  
  <hr>
  
  <p>@SouravA</p>
  
  <pre><code>create trigger SomeBeforeUpdateTrigger
  on YourTable
  before update
  as
  insert into SecondTable (ID, Name)
  select ID, Name
  from deleted; 
  go
  insert into SecondTable (ID, NewName)
  select ID, Name
  from inserted;
  </code></pre>