drop orphan temporary tables in sql server 2005
Posted on 2006-10-22
How do I dump orphaned temporary tables in sql server 2005? I have to restart my sql server every week or so because my tempdb is filling up with strange little temporary tables with names like:
I am guessing these were orphaned tables from a session that exited ungracefully. However, I always name my temp tables in the procs that I run so I'm not sure why they don't have names like
I'm guessing the former were created via a temp table variable like so
declare @mytemp table (myfield varchar(2))
I think that's how its done. In any event, whatever these orphans are, if they are orphans, then I want to nuke them.