all groups > sql server connect > august 2003 >
You're in the

sql server connect

group:

how long does a temporary table last



how long does a temporary table last Derek Ruesch
8/28/2003 8:40:35 AM
sql server connect: I am running a ColdFusion web based application that
excutes a stored procedure which creates a global
temporary table. How long does this table exist in the
database? I thought that it would go way after I closed my
web application but it doesn't.

Please help!

Thanks.

Re: how long does a temporary table last Sue Hoegemeier
8/28/2003 1:27:44 PM
Per books online:
Global temporary tables are automatically dropped when the
session that created the table ends and all other tasks have
stopped referencing them. The association between a task and
a table is maintained only for the life of a single
Transact-SQL statement. This means that a global temporary
table is dropped at the completion of the last Transact-SQL
statement that was actively referencing the table when the
creating session ended.

-Sue

On Thu, 28 Aug 2003 08:40:35 -0700, "Derek Ruesch"
[quoted text, click to view]
Re: how long does a temporary table last Dinesh.T.K
8/28/2003 4:04:20 PM
Derek,

Why dont you explicitly drop the temp table? or check for its existence
before creating ?

--
Dinesh.
SQL Server FAQ at
http://www.tkdinesh.com

[quoted text, click to view]

how long does a temporary table last Girish Patil
9/1/2003 2:20:26 AM
Temporary table u mean something like this #TableName ??
if this the case then as soon as u close the connection it
will be dropped.


[quoted text, click to view]
Re: how long does a temporary table last Allan Mitchell
9/1/2003 11:28:41 AM
There is a discussion in BOL on scope here

mk:@MSITStore:C:\Program%20Files\Microsoft%20SQL%20Server\80\Tools\Books\tsq
lref.chm::/ts_create2_8g9x.htm

--

----------------------------
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org



[quoted text, click to view]

AddThis Social Bookmark Button