Mark L. Breen
subs1847 at solution-providers.ie
Mon May 31 10:38:08 CDT 2004
Hello All, A guy called OJ gave me the answer it is if object_id('tempdb..#tmp','U') is not null print '#tmp exists' Thanks Mark ----- Original Message ----- From: "Mark L. Breen" <subs1847 at solution-providers.ie> To: <dba-sqlserver at databaseadvisors.com> Sent: Monday, May 31, 2004 8:56 AM Subject: [dba-SQLServer] Error Trapping and temp tables Hello All, I am developing a db and intend to use a temp table. Before use I create it and after use I drop it. However, because I fear it may somehow remain in the system, I would prefer to do a If exists (table name) drop table name But it is not that easy with temp tables, as you know, so I was considering using a vb function that attempts to drop the table, I can catch the error in vb, I hope, and ignore it. Have you guys any better suggestions how to do this. Basically, I want to check for the existence of a temp table and drop it if it exists. Thanks in advance, Mark _______________________________________________ dba-SQLServer mailing list dba-SQLServer at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-sqlserver http://www.databaseadvisors.com