Carlo Romagnano (11/22/2010)
WayneS (11/22/2010)
BTW, the best way to check for the existance of a temporary table in your current session is:
IF OBJECT_ID('tempdb..#YourTempTable') IS NOT NULL
Note that in SQL Server thru version 2008R2, temp tables are created with a positive object_id value, so you might want to use:
IF OBJECT_ID('tempdb..#YourTempTable') > 0
You can test <> 0
I always use
IF OBJECT_ID('tempdb..#YourTempTable') <> 0
😀