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
 General SQL Server Forums
 New to SQL Server Programming
 temp table

Author  Topic 

hai
Yak Posting Veteran

84 Posts

Posted - 2007-05-18 : 09:32:37
I have a developer that used temp table to store data using
the select * into #tbl. Apparently the data got delete, I was just wondering how hong does the temp #tbl hold the data, and when does it delete the data?

thanks

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-05-18 : 09:36:59
the data in the temp table will not be automatically deleted. However the temp table only exists within the scope. It is automatically dropped when it is out of scope


KH

Go to Top of Page

hai
Yak Posting Veteran

84 Posts

Posted - 2007-05-18 : 09:46:47
Khan,

what do you mean by scope? If the temp #table create by one user, can another user log in and use the temp #tbl? As you can see...i'm very new to this.

thanks
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-05-18 : 09:50:22
No. The local temp table created by one user will be visible only to him/her.

By scope, it means the temp table is visible only to the connection in which it is created. Once the connection is closed, the table cease to exist.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-05-18 : 11:25:18
Do google search on "Temporary table+sql server"

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2007-05-18 : 12:27:45
connection may be a bit misleading....it's "alive" for the life of the spid more specifically



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page
   

- Advertisement -