Technical Article

One line to drop a (temp) table if it exists

,

Put the code before your "create table #t..." statement. Easy way to avoid error messages whether #t already exists or not.

-- Drop table #t if it exists (swallow the error if not)
begin try drop table #t; end try begin catch end catch;

Rate

4 (7)

You rated this post out of 5. Change rating

Share

Share

Rate

4 (7)

You rated this post out of 5. Change rating