title: What can cause 'rows affected' to be incorrect?
body: <p>Using Microsoft SQL Server Management Studio 2008. I have done a simple transaction:</p>
  
  <pre><code>BEGIN TRAN
  
  SELECT ko.ID, os.ID AS ID2
  FROM table_a AS ko
  JOIN table_b AS os ON os.ID=ko.ID
  WHERE (ko.the_date IS NOT NULL AND os.the_date IS NULL);
  
  UPDATE table_b SET the_date=ko.the_date
  FROM table_a AS ko
  JOIN table_b AS os ON os.ID=ko.ID
  WHERE (ko.the_date IS NOT NULL AND os.the_date IS NULL);
  
  SELECT ko.ID, os.ID AS ID2
  FROM table_a AS ko
  JOIN table_b AS os ON os.ID=ko.ID
  WHERE (ko.the_date IS NOT NULL AND os.the_date IS NULL);
  
  
  ROLLBACK
  </code></pre>
  
  <p>So the SELECT and UPDATE should be the same. And the result should return 0 rows. But the UPDATE affects one row less than the SELECT gets from DB:</p>
  
  <p>(61 row(s) affected)</p>
  
  <p>(60 row(s) affected)</p>
  
  <p>(0 row(s) affected)</p>
  
  <p>What am I missing here?</p>