patternsqlMinor
Benefits of droping a temporary table
Viewed 0 times
dropingbenefitstabletemporary
Problem
What are the benefits (if any) of dropping a temporary table in SQL Server?
eg:
Since temporary tables are automatically dropped by the server this statement would seem to be non-functional.
eg:
DROP TABLE #temp;Since temporary tables are automatically dropped by the server this statement would seem to be non-functional.
Solution
I typically drop #temp tables explicitly just out of habit (I like cleaning up anything I create). There is a myth out there that dropping a #temp table explicitly will prevent #temp table caching and reuse, but this is not true: See this blog post by @PaulWhite for a lot more details, and this one for even more.
Context
StackExchange Database Administrators Q#52358, answer score: 7
Revisions (0)
No revisions yet.