title: SQL SELECT incremental batch number every X rows
body: <p>I'm trying to write a SQL SELECT query that has a batch number column that increments every 5 rows, I've tried using a hacky integer division on a dynamic row number, but can't get around the first batch number increment always being 4 rows instead of 5 (see image).</p>
  
  <p>RowNumber 1-5 should be 1, 6-10 should be 2 etc..</p>
  
  <p>Any ideas how I can achieve this?</p>
  
  <pre><code>select * ROW_NUMBER() OVER (Order by (select 0)) AS RowNumber,
  1 + convert(int, (ROW_NUMBER() OVER (Order by (select 0)) / 5)) as BatchNumber,
  * from WorkQueue
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/r1Nup.png" alt="enter image description here"></p>