PRB: Accessing a Temporary SQL Server Table Results in a DB_E_NOTABLE (238116)
The information in this article applies to:
- Microsoft ODBC Driver for SQL Server 2000.80.194, when used with:
- Microsoft Data Access Components 1.5
- Microsoft Data Access Components 2.0
- Microsoft Data Access Components 2.1
- Microsoft Data Access Components 2.5
- Microsoft Data Access Components 2.6
- Microsoft ODBC Driver for SQL Server 3.0, when used with:
- Microsoft Data Access Components 1.5
- Microsoft Data Access Components 2.0
- Microsoft Data Access Components 2.1
- Microsoft Data Access Components 2.5
- Microsoft Data Access Components 2.6
- Microsoft ODBC Driver for SQL Server 3.5, when used with:
- Microsoft Data Access Components 1.5
- Microsoft Data Access Components 2.0
- Microsoft Data Access Components 2.1
- Microsoft Data Access Components 2.5
- Microsoft Data Access Components 2.6
- Microsoft ODBC Driver for SQL Server 3.6, when used with:
- Microsoft Data Access Components 1.5
- Microsoft Data Access Components 2.0
- Microsoft Data Access Components 2.1
- Microsoft Data Access Components 2.5
- Microsoft Data Access Components 2.6
- Microsoft ODBC Driver for SQL Server 3.7, when used with:
- Microsoft Data Access Components 1.5
- Microsoft Data Access Components 2.0
- Microsoft Data Access Components 2.1
- Microsoft Data Access Components 2.5
- Microsoft Data Access Components 2.6
This article was previously published under Q238116 SYMPTOMS When using the SQL Server ODBC driver with forward-only
server-side cursors in trying to access a local temporary SQL Server table that
was explicitly created using the same ActiveX Data Object (ADO) connection
object, the application receives the following error message:
[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid
object name '#temptable12'. The HRESULT obtained is:
DB_E_NOTABLE // 0x80040e37
CAUSE The SQL Server ODBC driver does not support multiple active
recordsets on the same connection when using the forward-only cursor. The OLE
DB Provider for ODBC drivers attempts to work around this limitation by
creating a second connection. Since temporary tables are only visible to the
connection that created it, the application fails to find the table and returns
a DB_E_NOTABLE HRESULT. RESOLUTION Use one of the following solutions to correct the problem:
- Use ADO client-side cursors.
- Use the Microsoft OLE DB Provider for SQL
Server.
- Insert a rs.Release() call in between two execute calls in the Visual C++ code, when
using forward-only server-side cursors.
STATUS This behavior is by design. REFERENCES SQL Server Books Online
Modification Type: | Major | Last Reviewed: | 12/5/2003 |
---|
Keywords: | kbDatabase kbprb KB238116 kbAudDeveloper |
---|
|