title: How do I loop through a temp table in a stored procedure with no pk
body: <p><strong>Problem:</strong></p>
  
  <p>I need to loop through the records in one table, pulling the employee number and comparing this employee number against another table to see if they're still active employees. If they are no longer active employees I need to pass the data from this row into another stored proc.</p>
  
  <p><strong>Research:</strong></p>
  
  <p>I've googled around quite a bit and realize that I shouldn't use cursors for this. I did however, find the following examples:</p>
  
  <ol>
  <li><a href="http://ask.sqlservercentral.com/questions/7969/loop-through-records-in-a-temporary-table.html" rel="noreferrer">http://ask.sqlservercentral.com/questions/7969/loop-through-records-in-a-temporary-table.html</a></li>
  <li><a href="http://eedle.com/2010/11/11/looping-through-records-in-sql-server-stored-procedure/" rel="noreferrer">http://eedle.com/2010/11/11/looping-through-records-in-sql-server-stored-procedure/</a></li>
  </ol>
  
  <p>However, it seems like they use a pk to loop through the records. Employee numbers can be the same for multiple recods in my scenario </p>
  
  <p><strong>Questions:</strong></p>
  
  <ol>
  <li>Is it possible to achieve what I'm attempting without cursors?</li>
  <li>If it is possible, how would I go about fetching each row with a non unique column?</li>
  </ol>