title: How to store stored procedure return value in a table or variable
body: <p>I have a stored procedure in which I want to store a value returned by another stored procedure how would I do it. I tried and googled, but couldn't succeed. My code is:</p>
  
  <pre><code>declare @t table (name varchar(100))      
  declare @MprNum varchar(20)      
  insert @t exec usp_GetNextInvoice 'MPRId','MPRNo','MPRMain'       
  select @MprNum=name from @t 
  </code></pre>
  
  <p>I also tried this:</p>
  
  <pre><code>create table #t(name varchar(100))
  declare @MprNum varchar(20)
  insert #t exec usp_GetNextInvoice 'MPRId','MPRNo','MPRMain'
  select @MprNum=name from #t 
  </code></pre>
  
  <p>But no success.</p>