stilldream

Oracle数据库删除表前判断表是否存在SQL

declare vCount int;
begin
select count(1) into vCount from user_all_tables where Table_name = upper(\'testtable01\');
if(vCount > 0 ) then 
execute immediate (\'drop table testtable01\');
end if;
end;

SqlServer数据库删除表前判断表是否存在SQL

if exists (select * from dbo.sysobjects where id = object_id(N\'testtable01\') and OBJECTPROPERTY(id, N\'IsUserTable\') = 1)
drop table testtable01

PG数据库删除表前判断表是否存在SQL

DROP TABLE IF EXISTS testtable01

DM数据库删除表前判断表是否存在SQL

declare vCount int;
begin
select count(1) into vCount from user_all_tables where Table_name = upper(\'testtable01\');
if(vCount > 0 ) then 
execute immediate (\'drop table testtable01\');
end if;
end;

Mysql数据库删除表前判断表是否存在SQL

DROP TABLE IF EXISTS testtable01

分类:

技术点:

相关文章: