hi
!i used
some temporary table in store procedure (sqlserver 2005)our team have report software calisto
.the calisto
use crystal and reports which usethis store
procedure .because
of that,we have list
of many temporary table with the same name#dbo
.sug_name ... ,#dbo.sug_name ... ,......in
the system database .what could be the reason
for that and how can we drop itMsg 3701
, Level 11, State 5, Line 2Cannot
drop the table '#sug_name', because it does not exist or you do not have permission."
temporary table
Sugan
This may be because, temp tables are session specific and session is still active. So add these lines , before creation of temptable and at the end of StoredProcedure. Basically, what we are doing here is droping the table at the end of storedprocedure exclusively.
if
object_id('Tempdb..#Sometablename') is not null begin Drop table #Sometablename endMadhu
DanMeyers
when i run query :
select * from sysobjects where name like '#tmp%'
i get all the information of all the temp table
when i run :
SELECT
* FROM master..sysprocesses where status = 'sleeping'SELECT *
FROM
sys.dm_exec_sessionswhere
status = 'sleeping'i can not find the connection between spid,seession and temp table
Cem DEMiRKIR
hi
i just can't drop the #temp because the table created yesterday by store procedure .
when the procedure run ,maybe without droping the table #temp .
after finish executing , the table must be droped automatic !!!!
today i see the #temp in tempdb database and cannot return to the session which
the table was created !!! becaude using drop in a new session does not work !!!
XNA Rockstar
the problem is that i see the #tmp table with the object explorer in tempdb..temporary_tables
but i lost the session that executed the store procedure that missed the drop from some reason !!!
now i can drop the table only from the lost session
so maybe i cant restore the session .
is there another way to reach the temporary table
Martin Lundberg
HTH, Jens K. Suessmeyer.
---
http://www.sqlserver2005.de
---
GeeMann
have u read Suessmeyer post... the procedure to drop the table is described there... otherwise just check sysprocess table for active connection... if seession are still active kill them.... then automatically these table will get droped or
refer this link to kill sleeping session
http://www.sql-server-performance.com/forum/topic.asp TOPIC_ID=19496
or if this server has downtime then just restart the SQLService... it will automatically clear all temp tables. Notwithstanding, u must alter the code as i said
Madhu
Will Riley
DROP TABLE #SomeTable (although residing in the temp database)
HTH; Jens K. Suessmeyer.
---
http://www.sqlserver2005.de
---