Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if a temporary table is existing in Database

I am actually dropping a temporary table in Database. I have to delete only if it exists in the Database. Please let me know how to check if a table exists in Data base.

like image 246
Vinod Avatar asked Feb 24 '09 11:02

Vinod


1 Answers

if object_id('tempdb..#myTempTable') is not null
    drop table #myTempTable
like image 87
Steven Robbins Avatar answered Nov 08 '22 01:11

Steven Robbins