title: SQL Server Update trigger not working properly on batch update
body: <p>I have the following simple trigger for row update. What it is supposed to do is to update the LastUpdatedDate column on the rows that are updated. It works well with single row update but not the batch row update that is fired up from the application side.</p>
  
  <pre><code>ALTER TRIGGER [gc].[T_UpdateObservation] ON [gc].[GCUR_OBSERVATION] 
    AFTER UPDATE
  AS 
  BEGIN
      -- SET NOCOUNT ON added to prevent extra result sets from
      -- interfering with SELECT statements.
      SET NOCOUNT ON;
  
      -- get the last id value of the record inserted or updated
      DECLARE @id INT
      SELECT @id = [ObservationId]
      FROM DELETED
  
      -- Update statements for trigger here
      UPDATE GCUR_OBSERVATION
      SET GCUR_OBSERVATION.LastUpdatedDate = getdate()
      WHERE [ObservationId] = @id
  
  END
  </code></pre>
  
  <p>Could anyone give some tips? Thanks in advance!</p>
  
  <p>Cheers,
  Alex</p>