title: How do I pass temp table columns to a stored procedure?
body: <p>I have a stored procedure that calls another stored procedure within it. And I've created a temp table that have the values I want to pass to the inner stored procedure. Is there a way to do this without having to create a bunch of variables?</p>
  
  <p>An example:</p>
  
  <pre><code>CREATE PROCEDURE usr_AdminSaveChanges 
      -- Add the parameters for the stored procedure here
          @blah varchar(5) = NULL,
          @tid int = NULL
  AS
  BEGIN
      -- SET NOCOUNT ON added to prevent extra result sets from
      -- interfering with SELECT statements.
      SET NOCOUNT ON;
  
      -- only returns one row
      select testid, testfoo, testbar
      into #testtemp
      from testtable
      where tid = @tid
  
      exec usr_updateTestSP #testtemp.testid, @blah, #testtemp.testbar
  END
  </code></pre>