
|
Checking for existence of a # table The easiest way of checking for the existence of a # table is to check it's object id if exists(select 1 from tempdb.dbo.sysobjects where object_id = object_id('tempdb.dbo.#worktable'))
Note that you don't specify the hierarchic name on the drop but do include the # on the select from sysobjects (For 2005 replace with select 1 from tempdb.sys.objects) |