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 tables

Author  Topic 

nic
Posting Yak Master

209 Posts

Posted - 2003-09-17 : 12:20:32
Hi,
When a user creates a #temp table, I understand that it is visible only to the current connection for the user; and it is deleted when the user disconnects.

What happens if at the same time, the same user on a different connection creates the same temp table? Do both exist independently since they are on different connections?

I have a sproc that creates a temp table. I am curious what happens if the same sproc is called at the exact same time. (this is a web application so all users connect to the db in the same manner)

In testing I can't get this to happen but I know it can happen...

Nic

MichaelP
Jedi Yak

2489 Posts

Posted - 2003-09-17 : 12:36:10
Each Connection gets it's own unique copy of the Temp Table.

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

simondeutsch
Aged Yak Warrior

547 Posts

Posted - 2003-09-17 : 22:44:18
Unless its a ##Temp table, which is visible across all connections, and if its already created anyone attempting to create another one will get an error. ##Temp tables are destroyed when the last connection is.

Sarah Berger MCSD
Go to Top of Page
   

- Advertisement -