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
 Transact-SQL (2000)
 Dropping of temp tables

Author  Topic 

nivaskhan
Starting Member

17 Posts

Posted - 2002-06-19 : 04:42:13

Dear All,

Is it advisable to drop the temporary tables [used with in a procedure] at the end of Procedure OR NOT .Please let me know the advantages and the disadv...
Since in one of my procedure i use about 12-15 temp tables...
So i am little confused whether to drop the temp tables or not...

Nivas


Regards,
Nivas

macka
Posting Yak Master

162 Posts

Posted - 2002-06-19 : 04:50:33
Nivas,

Temporary tables are automatically dropped when they go out of scope. In the case of a stored procedure this is when it completes.
However its good practise to explicitly drop them (freeing up tempdb) as soon as you are finished with them.

Surely you can't be using all 12-15 tables at the same time ? If you're not then I'd suggest you only create the tables just before you need them and drop them as soon as you are done with them.

macka.

Go to Top of Page
   

- Advertisement -