Solved

MS SQL Multiple temp tables - clean up

Posted on 2011-09-13
3
300 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
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.

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now