title: Update one column in a trigger after updating only particular column in the same table in SQL Server 2008
body: <p>I have the following table with this structure:</p>
  
  <pre class="lang-SQL prettyprint-override"><code>CREATE TABLE [dbo].[Tasks]
  (
      [TasksID] [int] IDENTITY(1,1) NOT NULL,
      [CommitteeID] [int] NULL,
      [TransactionDateTime] [datetime2](7) NULL,
      [inspectionStatus] [nvarchar](50) NULL,
      [Latitude] [nvarchar](50) NULL,
      [Longitude] [nvarchar](50) NULL,
      [acceptanceState] [nvarchar](50) NULL,
      [comments] [nvarchar](350) NULL,
      [ScheduledDateTime] [datetime2](7) NULL,
  )
  </code></pre>
  
  <p>What I want exactly is to create a trigger that update <code>[TransactionDateTime]</code> with the current datetime, only if the column <code>[acceptanceState]</code> is updated.</p>
  
  <p>I have created the following trigger
  </p>
  
  <pre><code>CREATE TRIGGER [dbo].[TransactionDateUpdate]
  ON [dbo].[Tasks]
  AFTER UPDATE  
  AS BEGIN
     UPDATE dbo.Tasks
     SET TransactionDateTime = GETDATE()
     FROM INSERTED i
     WHERE i.TasksID = Tasks.TasksID 
  END
  </code></pre>
  
  <p>The problem with this trigger, that it updates the column <code>[TransactionDateTime]</code> but if I made change on any of the column in the table, and what I want is to update <code>[TransactionDateTime]</code> only if the column <code>[acceptanceState]</code> is changed/updated. Can I find any help? How to add the condition of updating <code>[TransactionDateTime]</code> only if <code>[acceptanceState]</code> is changed/updated?</p>
  
  <p>I searched a lot for the similar problem but I didn't find exactly the same problem.</p>