title: how to Increment int value of column in multiple rows of a returned set by one?
body: <p>I want to be able to increment the int value of a column returned in a result set of multiple rows by 1. for instance the following query will return a result set from a table that looks like the following:</p>
  
  <pre><code>select numinbatch from items i where i.ID &gt; @itemID and i.BatchID = @batchID
  
  4
  5
  6
  7
  </code></pre>
  
  <p>I want to update these values by incrementing them by 1 so that:</p>
  
  <pre><code>5
  6
  7
  8
  </code></pre>
  
  <p>I have the following for now but Im getting a red squiggly error line under the plus sign.</p>
  
  <pre><code>declare @idToIncrement as int
  declare cur cursor fast_forward for select numinbatch from items i where i.ID &gt; @itemID and i.BatchID = @batchID
  
      open cur
      fetch next from cur into @idToIncrement
  
      while @@FETCH_STATUS = 0
      Begin
      EXEC
  
      --increment numinbatch or @idToIncrement
      @idToIncrement= @idToIncrement + 1
  
       fetch next from cur into @field1, @field2
      END
  
      close cur
      deallocate cur
  </code></pre>
  
  <p>I know that cursors are bad for performance so if any one has a better solution feel free to share.</p>