Checking if a table exists, so that it may be dropped before recreating it

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Dr Tarheel (anonymous_at_discussions.microsoft.com)
Date: 05/06/04


Date: Thu, 6 May 2004 14:01:20 -0700

It may be argued that truncating the original and running an INSERT would be more efficient, but I am required to create the table afresh each time. There will be some occasions where the table may be already dropped. If that is the case, I'd like to skip the DROP TABLE command and go straight to the SELECT. I understand I can query sysobjects to determine if the table exists, but what is the most straight forward way to implement this. A code snippet would be a world of help.

Thanks,
Dr Tarheel