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)
 How to check the existence of Temp table

Author  Topic 

khufiamalik
Posting Yak Master

120 Posts

Posted - 2008-09-22 : 01:03:04
Hello All,
I have a Temporary Table, created in my SP.
I want to delete this table in case of any error.

can some one give me the syntax that how to check the existence of Temporary table.

ranganath
Posting Yak Master

209 Posts

Posted - 2008-09-22 : 01:08:23
Hi

Use Transactions
Go to Top of Page

khufiamalik
Posting Yak Master

120 Posts

Posted - 2008-09-22 : 01:20:31
I just want the syntax by which i can check that Temp table exists or not.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-09-22 : 01:51:50
quote:
Originally posted by khufiamalik

I just want the syntax by which i can check that Temp table exists or not.


If object_id('tempdb..#temp_name) is null
--temp tables doesnt exist
else
--temp tables exists


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -