By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,854 Members | 1,912 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,854 IT Pros & Developers. It's quick & easy.

Clearing temp tables

P: 4
//using C# 2005, MS SQL 2000(prod) and SQL Express 2005 (dev)

My sprocs all have a clearing mechanism at the end like this for each temporary table I use:
--drop temporary tables
IF EXISTS(SELECT name FROM [DBNAME]..sysobjects WHERE name = N'#Temp' AND xtype='U')

Every once in a while, something will happen to cause a hiccup and the table doesn't clear. The result is no results, not an error message (reader fails). I added the same code to the beginning of the procedure and it helped, but I didn't think that a temp table would persist in sysobjects. This happens from within using blocks in C# and I'm "sure" the connection is closed in code anyway.

Is this a known issue? I didn't really find anything similar in the msdn2 or sql areas.


Dec 26 '07 #1
Share this Question
Share on Google+
1 Reply

P: 4
This turned out to be a symptom of a mis-configured server with a linked server. The RPC settings were not turned on, so were not cleared in a timely fashion if the connection was severed/halted.
Jan 10 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.