November 30, 2007 at 10:03 am
Hi
How to check using T-SQL whether a global temp table exists ?
Any one help me ????
:):):)
thanks
venkat
November 30, 2007 at 10:14 am
I got it...
DECLARE @temp_table VARCHAR(100)
SET @temp_table = '##my_temp_table'
IF NOT EXISTS (SELECT 'x'
FROM tempdb..sysobjects
WHERE type = 'U' and NAME = @temp_table)
PRINT 'temp table ' + @temp_table + ' does not exist'
ELSE
PRINT 'temp table ' + @temp_table + ' exists.'
thanks
November 30, 2007 at 11:55 am
IF OBJECT_ID('TempDB..##my_temp_table','U') IS NOT NULL
PRINT 'Table Exists'
ELSE
PRINT 'Table does not Exist'
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply