title: How to insert into a temp table the info given by RESTORE FILELISTONLY / HEADERONLY / VERIFYONLY
body: <p>How to insert the resultset given by the commands</p>
  
  <pre><code>RESTORE FILELISTONLY
  RESTORE  HEADERONLY
  RESTORE VERIFYONLY
  </code></pre>
  
  <p>into an automatically generated temp table ?</p>
  
  <p>I would like to use a technique similar to (so the table is auto created, with all the columns matching the resultset's columns)</p>
  
  <pre><code>SELECT * INTO #TempTable 
  FROM (RESTORE FILELISTONLY FROM DISK = 'c:\Test\Test.bak')
  </code></pre>
  
  <p>But this doesn't work. If I could populate a TempTable I could then be able to use the information contained in it in a following SQL Statement (in my case a restore DB statement in which I need to use some strings contained in the resultset given by RESTORE FILELISTONLY)</p>
  
  <p>I am using sql server 2008.</p>