Posted on Thursday, June 10, 2010 4:21 PM
How to determine if a temp table already exists? Well, I found this sql script that works fine for me!
If the temptable already exists it will be dropped by the last line in the code.
if
exists (
select * from tempdb
.dbo
.sysobjects o
where o
.xtype
in ('U') and o
.id
= object_id(N'tempdb..#tablename')
)
drop table #tablename