Hi,
I can't seem to find a query to drop a temp table IF it exists. I know how to drop a table, but I don't want to get the error if the table is not there.
Thanks
if object_id('tempdb..#temptable')>0drop table #temptable|||
if object_id('tempdb..#temptable') is not null
drop table #temptable
-- because if #table doesn't exist, object_id will be null, not 0
No comments:
Post a Comment