title: FOR UPDATE cursor is returning a result set for each row!
body: <p>I'm using an UPDATE cursor as follows on SQL 2005:</p>
  
  <pre><code>DECLARE myCursor CURSOR FOR
          SELECT RowID, Value FROM myTable
          FOR UPDATE OF Value;
  OPEN myCursor;
  FETCH NEXT FROM myCursor
  WHILE (@@FETCH_STATUS &lt;&gt; -1)
      UPDATE myTable SET Value = 42
      WHERE CURRENT OF myCursor
      FETCH NEXT FROM myCursor
  END
  CLOSE myCursor
  DEALLOCATE myCursor
  </code></pre>
  
  <p>(Thanks to Matt for his correct answer on <a href="https://stackoverflow.com/questions/4504818/basic-syntax-on-for-update-cursor">my prior question</a> concerning this cursor syntax.  And yes, I do need a cursor, because each row's new value is actually based on a complicated calculation that depends on the prior rows.)</p>
  
  <p>This works correctly, updating all the Values. The problem is that it returns a result set for each row updated, consisting of RowID, Value (interestingly, its showing the result from <em>before</em> the row is updated). Eventually, I get the following error:</p>
  
  <blockquote>
    <p>The query has exceeded the maximum
    number of result sets that can be
    displayed in the results grid. Only
    the first 100 result sets are
    displayed in the grid.</p>
  </blockquote>
  
  <p>Any way to suppress these result sets? <code>SET NOCOUNT ON</code> doesn't do the trick.
  Is this just an issue I see running it directly in SSMS? Or will it actually try to return hundreds of result sets when I put this cursor inside a stored proc?</p>
  
  <p><strong>EDIT: Looks like it has nothing to do with the UPDATE.</strong></p>
  
  <p>Using <code>FETCH NEXT FROM myCURSOR</code> the way I am actually does return a result set of the next row from the cursor.</p>
  
  <p>If I change it to <code>FETCH NEXT FROM myCURSOR INTO @variables</code>, then it doesn't return a result set.</p>
  
  <p>So I guess the question now is: Since I'm using <code>WHERE CURRENT OF</code>, I don't really <em>need</em> the variable. I guess I can put them in just to suppress the result set, but is there a better way to do it?</p>