title: Trigger on table update is firing for more than the number of rows updated
body: <p>I have a trigger that is supposed to insert a new record into a audit history table (<code>EmployeeSalaryHistory</code>) upon the updating of the <code>Employees</code> table that the trigger is set to be on ON.</p>
  
  <p>If I do an <code>UPDATE</code> on <code>Employees</code> where all the rows in the table are updated the trigger is called more times than the number of rows that are being updated.</p>
  
  <p>e.g. if there are three rows in the <code>Employees</code> table the <code>INSERT</code> happens 9 times.</p>
  
  <pre><code>/*This UPDATE will cause the trigger to fire more than the number of rows in the Employees table.*/
  UPDATE Employees SET Salary = Salary * 2 
  
  /* supposed to be fired whenever the salary of an employee is updated */
  CREATE TRIGGER [dbo].[EmployeesUpdateSalary] ON [dbo].[Employees]
  AFTER UPDATE
  NOT FOR REPLICATION
  AS
  BEGIN
  
  INSERT INTO EmployeeSalaryHistory(EmployeeID, NewSalary, OldSalary)
  SELECT I.EmployeeID, I.Salary, D.Salary
  From inserted I, deleted D
  WHERE I.Salary &lt;&gt; D.Salary
  
  END
  </code></pre>