Nonshareable Temporary Tables

Nonshareable temporary tables (temp tables) have several uses, including debugging stored procedures and triggers.

Unlike standard tables, where data needs to persist beyond the existing session, use temporary tables when data is required only within a single process or session.

You define a temporary table by including a pound sign (#) at the beginning of the table's name. A temporary table is created and populated in the system database tempdb and includes a numerical identifier appended to the end that differentiates it from similarly-named #temp tables. For example, if you create the temporary table #test_temp, the actual table name might be #test_temp00002013927. The temporary table and data it contains is visible only in the current scope (stored procedure, set of nested stored procedures, or trigger). The table is dropped automatically when the session ends, or if you manually drop the table.

Note: Although the temp table is dropped automatically when the session in which it is created ends, it is more efficient to drop the table when you are finished using it.

Temporary tables allow for short term use of data, some examples include:


Related tasks
Creating an ASE Nonsharable Temporary Table
Debugging an ASE Stored Procedure Using a Temporary Table
Launching a Database Debug Session from an Editor
Setting a Breakpoint


Created June 25, 2009. Send feedback on this help topic to Sybase Technical Publications: pubs@sybase.com