在不同数据库中如何删除已存在的表的脚本写法

来源:互联网 发布:linux服务器开通外网 编辑:程序博客网 时间:2024/05/22 11:58
mysql

drop table if exists myTable


mssqlserver


方式一

if exists(select * from sys.objects where object_id = OBJECT_ID('myTable') and type in ('U')) drop table myTable;


方式二

if exists(select * from INFORMATION_SCHEMA.TABLES where TABLE_NAME = 'myTable') drop table myTable;


0 0
原创粉丝点击