Monday, August 27, 2012

How do you create temp tables in Sybase?

You can create Sybase temp tables in 2 ways :

1. CREATE TABLE #TableName
2. CREATE TABLE tempdb..TableName

Temp table being created with "#" are accessible by the current session or procedure and the table gets  automatically dropped when the session/procedure ends or is dropped manually.

Table being created using "tempdb..TableName" resides in tempdb database and remains as long as not dropped in manually. It is shareable among all sessions.

** If a table is created in any database other than tempdb, it won't be a temp table.

No comments :