title: SQL Stored Procedure OUTPUT Return Multiple Rows
body: <p>I need to return a list of all reports in a report table that have not been processed yet.  I am using stored procedures for this process.  </p>
  
  <p>Here is my stored procedure creation:</p>
  
  <pre><code>CREATE PROCEDURE spGetAllUntouchedReportID
  @ReportID int OUTPUT
  
  AS
  BEGIN
      SELECT @ReportID=Report.ReportID
      FROM Report
      WHERE Report.Status IS NULL
  END
  </code></pre>
  
  <p>And this is how I am calling the stored procedure:</p>
  
  <pre><code>DECLARE @ReportID int
  EXECUTE spGetNextReportID
  @ReportID OUTPUT
  Print @ReportID
  </code></pre>
  
  <p>Essentially a C# app will be connecting and getting the result set but I am using the call to test it out.  My problem is that the call to the stored procedure is only printing the LAST result it found.</p>
  
  <p>Here is an example set for the table of reports:</p>
  
  <pre><code>ReportID  Status
  1         NULL
  2         Incomplete
  3         NULL
  </code></pre>
  
  <p>A call to the procedure prints out:</p>
  
  <pre><code>3
  </code></pre>
  
  <p>Instead of:</p>
  
  <pre><code>1
  3
  </code></pre>
  
  <p>How do I get my stored procedure to store the set that it returns from the stored procedure and call it to print each one out?  This may come up in other stored procedures too where I need to do a Select * that has multiple columns and need to return the entire set</p>