A temporary table is created with a SELECT .. INTO statement
SELECT *
INTO #MyTempTable
FROM ...
Under Databases, tempdb, Temporary Tables I see the temp table dbo.#MyTempTable____________________0000000016CA
Now I want to drop the table. I tried the following:
DROP TABLE IF EXISTS #MyTempTable
AND
IF OBJECT_ID('tempdb..#MyTempTable') IS NOT NULL
BEGIN
DROP TABLE #MyTempTable
END
Both didn't delete the table
The Select returns NULL:
SELECT OBJECT_ID('tempdb..#MyTempTable')
##MyTempTable
<>#MyTempTable
. - Larnu