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)
 How to check the existence of global temporary table in SQL Server 2000 ?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-07-15 : 10:25:53
Sandeep writes "Hi,
I'm creating a global temporary table in an application of mine using SQL Server 2000. In multi-user environment, if the temporary table already exists, creating that table again throws error. I understand that temporary tables don't have any information in the system tables of SQL Server DB. Then, how can I check whether temporary table already exists or not before creating a new one ?

Thanks in advance,
-Sandeep"

ditch
Master Smack Fu Yak Hacker

1466 Posts

Posted - 2004-07-15 : 10:45:17
if exists(SELECT name from tempdb..sysobjects where name = '##MyGlobalTempTable')
begin
..... create table
end
else
begin
.... don't create table
end


Duane.
Go to Top of Page
   

- Advertisement -