Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Temp Table Lastability

Author  Topic 

mikebird
Aged Yak Warrior

529 Posts

Posted - 2008-03-28 : 05:30:56
Creating / Dropping #table yesterday, checking contents. About 30,000 rows.

Is there a time after which it disappears? I came in this morning and the object is now invalid. No worries, but it would be nice to know how long these last and if there are settings for these..?

Don't know why I chose a temp table - perhaps if I forget about it would clear up after itself eventually - it's just a quick sketchpad workspace

Thanks

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-03-28 : 05:35:00
It remains until dropped or the connection that was used to create the table is closed.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

mikebird
Aged Yak Warrior

529 Posts

Posted - 2008-03-28 : 06:01:01
Ahhhh, so if I put the PC on standby overnight, running Query Analyzer, the table would disappear, or if it was created in a stored procedure and completed?
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-03-28 : 07:37:22
Yes. If the temp table is created in a stored procedure, the temp table is automatically dropped when stored procedure ends and temp table is "out of scope".



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -