Temp tables in SQL Server 2005 not automatically dropped

前端 未结 2 1190
被撕碎了的回忆
被撕碎了的回忆 2021-01-15 12:23

I\'m troubleshooting a nasty stored procedure and noticed that after running it, and I have closed my session, lots of temp tables are still left in tempdb. They have names

2条回答
  •  滥情空心
    2021-01-15 12:41

    http://www.sqlservercentral.com/Forums/Topic456599-149-1.aspx

    If temp tables or table variables are frequently used then, instead of dropping them, SQL just 'truncates' them, leaving the definition. It saves the effort of recreating the table next time it's needed.

提交回复
热议问题