Focal Point
Sybase Temp Tables

This topic can be found at:

February 23, 2004, 02:33 PM
Sybase Temp Tables
Does anybody know how to use and retrieve data from Sybase style temp tables?
Everything I've tried has resulted in failures.


-- Kirk
February 23, 2004, 05:04 PM
What type of temp tables are you talking about?

Last time I worked with Sybase (10/11) there were 3 different types of temp tables all with different persistence/availability options.

1. If you created the table as tempdb..table_name, the table would exist until deleted or until the Sybase instance was restarted. Anybody (with required permissions) could view these tables.

2. If you created the table as #table_name via a SQL statement, the table would only exist as long as your Sybase session was active. As soon as you log out, the table would be deleted. Also, only the session in which the tables was created could query it. If you are creating the table in one request and then trying to report on it in another request, you may be getting disconnected from the server and then reconnecting. This means the table is getting deleted.

3. If you created the tables as #table_name via a stored procedure, the table only exist as long as the stored procedure is running. As soon as the stored procedure finishes, the table is deleted. I don't believe WF (or any other product) cannot access these tables.
February 24, 2004, 03:01 PM
They are the # style tables. I've tried to do everything within one sql statement and as seperate sql statements within one fex. Nothing works.

I can't create the table within tempdb directly, because multiple users might be running the same report at any one time.
February 26, 2004, 03:55 PM
You can try using HOLD files on reporting server side. It may work with aggregated data nicely.