Explicitly drop temp table or let SQL Server handle it
My view is, first see if you really need a temp table – or – can you make do with a Common Table Expression (CTE). Second, I would always drop my temp tables. Sometimes you need to have a temp table scoped to the connection (e.g. ##temp), so if you run the query a second … Read more