title: Output to Temporary Table in SQL Server 2005
body: <p>I am trying to use the <code>OUTPUT</code> clause <em>inside a stored procedure</em> to output to a temporary table the values of an indentity column after an <code>INSERT</code>.</p>
  
  <pre><code>CREATE TABLE #Test
  (
      ID INT
  )
  
  INSERT INTO [TableB] OUTPUT INSERTED.ID #Test SELECT * FROM [TableA]
  </code></pre>
  
  <p>However, when I execute this procedure SQL Server shows me the results in a table (correctly) called <code>Test</code> but if I write <code>SELECT * FROM #Test</code> as the next statement in the stored procedure it shows me nothing. How can I efectively accomplish this?</p>