title: Why does using @Table variables cause Adodb issues in the application?
body: <p>I have [MySp], A stored procedure.</p>
  
  <p>So check this out.. when I run this it works:</p>
  
  <pre><code> SELECT ID,Name FROM Table
  </code></pre>
  
  <p>But, When I do this, I get an error on the application side (Adodb)</p>
  
  <pre><code> Declare @Table TABLE(ID int,Name varchar(10))
  
   --- Inserts into table variable ---
   INSERT INTO @Table
   SELECT ID,Name FROM Table
  
   --- Returns data from table variable ---
   SELECT ID,Name FROM @Table
  </code></pre>
  
  <p>Keep in mind, in SQL Console i get the same results for [MySp], but in the application/adodb code i get errors.</p>
  
  <p>ASP Code:</p>
  
  <pre><code>Set oRS = Server.CreateObject("Adodb.Recordset")
  oRS.Open "[MySp]", Conn
  If oRS.EOF Then...  &lt;--Gives an error
  
   ADODB.Recordset error '800a0e78'
   Operation is not allowed when the object is closed. 
  </code></pre>
  
  <p>Does anyone know why I'm getting this error when I use Table variables in SQL?</p>