|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Checking if a temporary table exists
Does anyone know an efficient way to check if a temporary table exists?
I have done: Code:
IF EXISTS (SELECT * FROM ##Temp) PRINT 'TRUE' But if there are no rows in the table this doesnt work. I cannot seem to find an entry in the sysobjects table for temporary tables.. Thanks for your help |
|
#2
|
||||
|
||||
|
object_id function will return a long to identify the object, if NULL then it doesn't exist.
very cool function if object_id('##tempddd') is null print 'TRUE' |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Checking if a temporary table exists |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|