title: sql server: How to detect changed rows
body: <p>I want to create a trigger to detect whether a row has been changed in SQL Server.  My current approach is to loop through each field, apply COLUMNS_UPDATED() to detect whether UPDATE has been called, then finally compare the values of this field for the same row (identified by PK) in inserted vs deleted.  </p>
  
  <p>I want to eliminate the looping from the procedure.  Probably I can dump the content of inserted and deleted into one table, group on all columns, and pick up the rows with count=2.  Those rows will count as unchanged.</p>
  
  <p>The end goal is to create an audit trail: 
  1) Track user and timestamp
  2) Track insert, delete and REAL changes</p>
  
  <p>Any suggestion is appreciated.</p>