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 2005 Forums
 Transact-SQL (2005)
 Two questions for global temporary table

Author  Topic 

Sun Foster
Aged Yak Warrior

515 Posts

Posted - 2009-09-18 : 06:45:38
In a store procedure, I use global temporary table to store data to be called by another store procedure in ASP.NET program.
I have two questions:
1) Does global temporary will interupt each users? That is, if 100 users use the same global table, are they share the same data in global temporary table? (I hope not. Local temporary table has its own ID for each user)
2) How to drop global temporary table, in store procedure or in ASP.NET?

YellowBug
Aged Yak Warrior

616 Posts

Posted - 2009-09-18 : 07:52:46
1.) Global temporary tables are visible to all SQL Server connections/users.
2.) Drop global temporary table in store procedure. I prefer to have stored procedures instead of embedded SQL.

if object_id('tempdb..##temptbl') is not null
begin
drop table ##temptbl
end

Go to Top of Page
   

- Advertisement -