check temp table
IF OBJECT_ID(‘tempdb..##test’) IS NOT NULL
BEGIN
PRINT ‘#temp exists!’
END
ELSE
BEGIN
PRINT ‘#temp does not exist!’
END
IF OBJECT_ID(‘tempdb..##test’,’u’) IS NOT NULL
BEGIN
PRINT ‘#temp exists!’
END
ELSE
BEGIN
PRINT ‘#temp does not exist!’
END
select * from tempdb.dbo.sysobjects o
WHERE xtype = ‘U’