How to check a Local Temporary Tables are present on Database?

 Posted by vishalneeraj-24503 on 1/20/2015 | Category: Sql Server Interview questions | Views: 527 | Points: 40
Answer:

We have to write tempdb.. followed by Table name in object_id because Temporary Tables are stored in TempDB database.
if(object_id('tempdb..#temp_table_name') is not null)

print 'Table Exists';
else
print 'Not Exists';


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response