Solved

MS SQL Multiple temp tables - clean up

Posted on 2011-09-13
3
336 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
[X]
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
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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

Suggested Solutions

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

726 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