Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

MS SQL Multiple temp tables - clean up

Posted on 2011-09-13
3
329 Views
Last Modified: 2012-06-27
I have some massive Stored Procs that create temp tables by the 10's.  What is the best way to ensure those are all clean up in a timely manner with in the proc?

We are having resouces issues in the SQL 2000 databases and my job is to find a way to tweak it, but for I go out on the limb and say  - Move 2008.

Thanks
0
Comment
Question by:TimSweet220
3 Comments
 
LVL 21

Accepted Solution

by:
JestersGrind earned 250 total points
ID: 36531539
If you want to clean the temp tables up in the stored procedure that is creating them, you need to execute a DROP TABLE #YourTempTableName for each temp table created at the end of the stored procedure.  

Greg

0
 
LVL 9

Assisted Solution

by:sarabhai
sarabhai earned 250 total points
ID: 36531604
can u show the code of that store procedure?

or u can use the

DROP TABLE #tempTable
or
DROP TABLE ##tempTable

0
 

Author Comment

by:TimSweet220
ID: 36531713
Most of the table are dropped found a few that were.

If a proc is created 10 temp tables, how resource intense are they, some are dropped right way some are queried against later on in the procedures.  Some with as many fields a 30 and 100's of records.  

0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Viewers will learn how the fundamental information of how to create a table.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question