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 tables and users

Author  Topic 

jjradha
Starting Member

5 Posts

Posted - 2008-04-28 : 09:45:12
Hi all,

Suppose I have the following code inside a stored procedure:

/*--------------------------------------------------------------* Temp table V1 to store the result from Progress - begin
\*--------------------------------------------------------------*/
IF OBJECT_ID('tempdb..#V1') IS NOT NULL
DROP TABLE #V1

create table #V1 (

rownum int identity (1,1) primary key not null,
jobdate datetime,
item nvarchar(30)

); /*table #V1 definition*/
/*---------------------------------------------------------------* Temp table V1 to store the result from Progress - end
\*---------------------------------------------------------------*/


what happens if several users run this same stored procedure at the same time?
Will SQL create a separate temp table #V1 for each of the users?

TIA,



Marcelo Miorelli

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-04-28 : 09:46:34
Yes. Local temporary table is visible only to the connection which creates it. So there will be multiple copies (one per connection) if multiple users execute it at the same time.

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

jjradha
Starting Member

5 Posts

Posted - 2008-04-28 : 09:49:00
Thanks a lot harsh, I kind of knew it, but was not 100% sure.

Marcelo Miorelli
Go to Top of Page
   

- Advertisement -