title: SQL Server trigger on specific column updated
body: <p>I have a table with the following columns:</p>
  
  <pre><code>ID | CLIENT_SYNCED_TIME  |  NAME  | DESCRIPTION | LM_TIME
  </code></pre>
  
  <p>The <code>LM_TIME</code> column will be set automatically by a trigger when any of the other column values get updated.</p>
  
  <p>However I want the <code>LM_TIME</code> .... <strong>NOT</strong> to get updated by the trigger when the <code>CLIENT_SYNCED_TIME</code> column is updated.</p>
  
  <p>I am using the below trigger right now, which updates the <code>LM_TIME</code> when any of the column value is changed.</p>
  
  <p>Simply I just want to make the trigger not to worry about <code>CLIENT_SYNCED_TIME</code> column. What modifications I have to make to achieve this effect?</p>
  
  <pre><code>SET ANSI_NULLS ON
  GO
  
  SET QUOTED_IDENTIFIER ON
  GO
  
  CREATE TRIGGER [dbo].[updateLM_TIME]
  ON [dbo].[INSTITUTIONS]
  AFTER INSERT, UPDATE 
  AS
      UPDATE dbo.INSTITUTIONS
      SET lm_time = CONVERT(DATETIME, CONVERT(VARCHAR(20), GETDATE(), 120))
      WHERE ID IN (SELECT DISTINCT ID FROM Inserted)
  GO
  </code></pre>