title: Save result of stored procedure in a Table variable
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/653714/how-to-select-into-temp-table-from-stored-procedure">How to SELECT * INTO [temp table] FROM [stored procedure] </a>  </p>
  </blockquote>
  
  
  
  <p>I have a nested stored procedure call</p>
  
  <p>In one of the stored procedures I want to save the result into a table variable likt this : </p>
  
  <pre><code>INSERT INTO @myTable 
  EXEC sp_myStoredProcedure
  </code></pre>
  
  <p>however, because the proc. is nested the following error occurs :
  An INSERT EXEC statement cannot be nested</p>
  
  <p>The procedure must be called from another procedure, changing this is not an option.
  I wanted to try to use an output parameter but it still has to be set with a Insert into statement.</p>
  
  <p>What are other options to save the data that is retrieved from the call of a Stored Procedure into a variable ?</p>