Toad World® Forums

DB2 Global Temp Table

I have a situation where I have a list of ID’s that reside on a SQLServer, and I need to match those ID’s to records in a table on a DB2 server. I have created a global temp table using the below code on the DB2 server, but when I try to run the import wizard to import my query from SQLServer, I can not find my temp table anywhere. I do this regularly between SQLServers that I can not open row set between and have to adjust to show the tempdb. This did not seem to be the case for DB2. I am new to DB2 so any help you can provide is appreciated.

This is how I am creating the temp table:

DECLARE GLOBAL TEMPORARY TABLE SESSION.TempTable

(

ID VARCHAR(21) NOT NULL

) ON COMMIT PRESERVE ROWS

I believe that type of temp table is only retained for the life of the session. When using import we use multiple connections, so I suspect the table is not in the same open session. Can you create a table, insert and then drop manually?

No unfortunately my access is only read only and I do not have power user access to create a table to temporarily store the data. With SQL Server connections I can create global temps and import data by finding the tempdb database. It sounds like sessions in DB2 are not the same as this.

why not use a cross-connection query to join the data?

See these videos

http://www.toadworld.com/products/toad-data-point/m/media-library/1319

http://www.toadworld.com/products/toad-data-point/m/media-library/1317