I am trying to create a procedure that first drops the table “table” but only if it already exists.
How do I create the statement using “if exists” or something similar to this?
Drop table mytableselect * into mytablefrom othertable
This statement returns an error if the table does not already exist.
What you are after is this:
IF EXISTS (SELECT name FROM sysobjects WHERE type = 'U') DROP TABLE mytableEND