INF: Temporary Tables and CursorsID: Q118664
|
The DB-Library (and VBSQL) cursor functions use the catalog stored procedures to retrieve system table information from the database. The current SQL Server version 4.2 catalog stored procedures do not work against temporary tables. Thus, you cannot open a cursor using a SELECT that references a temporary table at this time.
Cursors can be opened against sets of temporary information by using a
permanent table that contains an additional column containing the users
server process ID (SPID). The SPID is a value that is guaranteed to be
unique to each connection to SQL Server.
This technique requires a table of the form:
create table temp_table (spid int, col int)
go
create unique index tidx on temp_table( col )
go
delete from temp_table where spid = @@spid
insert into temp_table (spid, col) values (@@spid, 25)
select col from temp_table where spid = @@spid
Additional query words: dbcursoropen temp temporary dblib
Keywords : kbprg SSrvDB_Lib
Version : 4.2 | 4.2
Platform : OS/2 WINDOWS
Issue type :
Last Reviewed: March 20, 1999