title: Trigger and update to a row in SQL Server after it's been updated
body: <p>Is this the best way to keep a simple track of changes to a database row:</p>
  
  <pre><code>ALTER TRIGGER [dbo].[trg_121s] 
  ON  [dbo].[121s]
    AFTER UPDATE
  AS 
  BEGIN
  -- SET NOCOUNT ON added to prevent extra result sets from
  -- interfering with SELECT statements.
  SET NOCOUNT ON;
  
  -- Insert statements for trigger here
  
  update dbo.[121s]
  set modified=getdate()
  where id in 
  (select distinct ID from Inserted)
  
  END
  </code></pre>
  
  <p>So any update to a row in [121s] will result in the <strong>modified</strong> column being updated.</p>
  
  <p>It works, but I'm not sure if it's the best way to achieve this.</p>
  
  <p>I'm a litle confused over this line:</p>
  
  <pre><code>(select distinct ID from Inserted)
  </code></pre>
  
  <p>...and how it knows it's getting the correct row ID.</p>
  
  <p>Thanks for any confirmation/clarification,</p>
  
  <p>Mark</p>