title: SQL Server loop - how do I loop through a set of records
body: <p>how do I loop through a set of records from a select?</p>
  
  <p>So say for example I have a few records that I wish to loop through and do something with each record. Here's a primitive version of my select:</p>
  
  <pre><code>select top 1000 * from dbo.table
  where StatusID = 7 
  </code></pre>
  
  <p>Thanks</p>