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)
 Creating temp tables inside a stored procedure

Author  Topic 

delpiero
Yak Posting Veteran

98 Posts

Posted - 2005-03-16 : 21:47:04
Hi all,

Suppose I create a temp table (like create table #temp_result (temp_value varchar(10) ) ) inside a stored procedure for data manipulation. When I call the stored procedure, the table will be created, and it will be automatically destroyed when the statement calling the procedure completes.

If many users are calling the stored procedure at the same time, will they create multiple copies of the table at the same time? Does it cause any confusion or inconsistency?

Even if I explicitly use a drop table statement before or after creating the temp table, I guess there must be some time that more than one user will create the temp table at the same time?

Thanks for your help,
delpiero

robvolk
Most Valuable Yak

15732 Posts

Posted - 2005-03-16 : 21:48:26
Yes, they can create multiple tables simultaneously, however each copy is isolated within the session that created it, and will not interfere with the others.
Go to Top of Page

delpiero
Yak Posting Veteran

98 Posts

Posted - 2005-03-16 : 21:53:50
Thanks a lot!

delpiero
Go to Top of Page
   

- Advertisement -