So, recently a DBA is trying to tell us that we cannot use the syntax of
SELECT X, Y, Z
INTO #MyTable
FROM YourTable
To create temporary tables in our environment, because that syntax causes a lock on TempDB for the duration of the stored procedure executing. Now, I’ve found a number of things that detail how temporary tables work, scope of execution, cleanup and the like. But for the life of me, I don’t see anything about blocking because of their use.
We are trying to find proof that we shouldn’t have to go through and do CREATE TABLE #MyTable… for all of our temporary tables, but neither side can find proof. I’m looking for any insight SO people have.
Additional Information
Currently working with SQL Server 2005, and soon to be SQL Server 2008 (Enterprise editions)
That advice has been floating around for a long time:
Fortunately, it was only a problem for SQL 6.5. It was fixed in 7.0 and later.