#set TITLE = "Temporary tables"
#include top

.SH Temporary tables
Temporary tables are created using the 
#set FILE = "select.html#into"
#set TAG = "SELECT INTO"
#include link
or 
#set FILE = "createstream.html"
#set TAG = "CREATE STREAM"
#include link
commands.
After a temp table is created it may be accessed like any other table using \fCSELECT\fR.
Temporary tables are unique to a
process; one process cannot access or modify temp tables created by another process
(if you need to do this, use
#set FILE = "ordfiles.html"
#set TAG = "ordinary files"
#include link
instead).
Temp tables cannot be manipulated using \fCINSERT\fR, \fCUPDATE\fR, or \fCDELETE\fR,
nor can indexes be created for them.
See also the
#set FILE = "tabletypes.html"
#set TAG = "shsql table types chart."
#include link


#include space

.SH Names
\fBshsql\fR temp table names always begin with a dollar sign ($).  Otherwise temp table names
follow the same naming rules as
#set FILE = "tables.html"
#set TAG = "regular tables."
#include link

.LP
Temporary tables provide a way of "chaining" or combining commands.
These are particularly useful with \fBshsql\fR since the more elaborate forms of
some commands aren't supported.  For instance, you can put the results of
a two-table join into a temp table, then join that temp table against another
table.  
.LP

#include space

.SH Removing temp tables
#set FILE = "drop.html"
#set TAG = "DROP TEMPTABLE"
#include link
may be used to explicitly remove temporary tables.

.ig >>
<a name=cleanup></a>
.>>
#include space

.SH Cleaning up old temp table files
Temp tables are stored as files either in \fCtmpdir\fR or \fCdbtmptabledir\fR as defined in the 
#set FILE = config.html
#set TAG = "project config file"
#include link
Old temp table files may accumulate over time and these should be
#set FILE = "maint.html#other"
#set TAG = "cleaned up periodically."
#include link

#include bottom
