title: Trying to insert a stored procedure into a temporary table, getting 'an object or column name is missing or empty'
body: <blockquote>
    <p><strong>Possible Duplicate:</strong>
    <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 am new to <a href="http://en.wikipedia.org/wiki/Transact-SQL" rel="noreferrer">T-SQL</a>. I have a <a href="http://en.wikipedia.org/wiki/Stored_procedure" rel="noreferrer">stored procedure</a> that selects records. I want to query the records returned by the stored procedure, so I am trying to insert the records into a temporary table. (Stack&nbsp;Overflow posts and other posts say that is how to do it.)</p>
  
  <p>But when I try, I get the error:</p>
  
  <blockquote>
    <p>object or column name is missing or empty'</p>
  </blockquote>
  
  <p>When I just run the stored procedure, I get a table that has columns with names.</p>
  
  <pre><code>select * into #temp1
  exec alexander.dbo.get_uberrecords '20120101', '20120201', 'labcorp' //throws error saying columns must have names
  </code></pre>
  
  <p>but</p>
  
  <pre><code>exec alexander.dbo.get_uberrecords '20120101', '20120201', 'labcorp' // Returns cols with names
  </code></pre>
  
  <p>What am I missing?</p>