title: SQL update trigger only when column is modified
body: <p>By looking at other examples I've come up with the following but it doesn't seem to work as I would like: I want it to only update the modified information if the <code>QtyToRepair</code> value has been updated... but it doesn't do that. </p>
  
  <p>If I comment out the where then the modified information is updated in every case. As I said other examples led me to be optimistic. Any clues appreciated. Thanks.</p>
  
  <p>Walter</p>
  
  <pre><code>ALTER TRIGGER [dbo].[tr_SCHEDULE_Modified]
     ON [dbo].[SCHEDULE]
     AFTER UPDATE
  AS 
  BEGIN
      SET NOCOUNT ON;
  
      UPDATE SCHEDULE SET modified = GETDATE()
          , ModifiedUser = SUSER_NAME()
          , ModifiedHost = HOST_NAME()
      FROM SCHEDULE S
      INNER JOIN Inserted I on S.OrderNo = I.OrderNo and S.PartNumber = I.PartNumber
      WHERE S.QtyToRepair &lt;&gt; I.QtyToRepair
  END
  </code></pre>