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)
 Temporary Table Lifetime

Author  Topic 

SamC
White Water Yakist

3467 Posts

Posted - 2003-03-25 : 10:58:15
What is the lifetime of a temporary table if it is not dropped in the creating procedure?

Sam

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2003-03-25 : 11:15:44
It exists for the life of the batch.

Jay White
{0}
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2003-03-25 : 14:31:00
Local Temporary table or Global?

Jay is correct with a local, but I believe a global will hang around as long as it's being referenced.



Brett

8-)
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2003-03-25 : 15:05:24
Local. I was curious as to whether bad programming (omitting the drop) could erode db resources.

Thanks Jay and Brett,

Sam

Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2003-03-25 : 15:26:37
I prefer to make sure I perform all housekeeping, like drops, as a matter of practice.

Just like dotting your t's and crossing you i's

I don't know, anyone else have a preferance?



Brett

8-)
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-03-25 : 20:37:17
Yeah, I make it a habit to always drop them explicitly. Lots of times it takes care of itself as I'll CREATE or SELECT INTO the temp table on each run, and I get an error that it already exists.

Although, it SUCKS when I need those results in either another window, or just after I closed the one it was created in.

Go to Top of Page
   

- Advertisement -