OK, so Sybase (12.5.4) will let me do the following to DROP a table if it already exists:
IF EXISTS (
SELECT 1
FROM sysobjects
WHERE name = \'a_t
There is no other way than calling create table
in execute("create table ...")
SYBASE Manual says:
When a create table command occurs within an if...else block or a while loop, Adaptive Server creates the schema for the table before determining whether the condition is true. This may lead to errors if the table already exists. To avoid this situation, either make sure a view with the same name does not already exist in the database or use an execute statement, as follows:
if not exists
(select * from sysobjects where name="my table")
begin
execute "create table mytable(x int)"
end