title: Multi Select Statement Stored Procedure in SQL Server2008
body: <p>I created following Store procedure whose return </p>
  
  <pre><code>Create PROCEDURE GetData (@Year varchar(20),@Month varchar(20), @Workcell varchar(100))
  AS
  BEGIN
  declare @StageName varchar(50)
  declare @Amount bigint
  declare @Stages table(Stage varchar(100))
  create table #ResTable (Stage varchar(100),Amount bigint)
   select Distinct(Stage) into #Stages from Stage_Skill_Matrix
  
  while exists(select * from #Stages)
  begin
   select top 1 @StageName = Stage
  from #Stages
  select top 1 @Amount =Amount from Stage_Req_Master where Month=@Month and Stage=@StageName and Workcell=@Workcell
  
  insert into #ResTable values(@StageName,@Amount)
  end
  select * from #ResTable
  
  END
  GO
  </code></pre>
  
  <p>After executing this Stored procedure I am expecting StageName and Amount from Temporary table ResTable that is Stages and their Amount.</p>
  
  <p>Rather when I execute the SP through Right Click->Execute Stored Procedure, it does not show me anything. It just goes on executing but I can see 40row affected in Message Window but no rows in Result window</p>