SQLServer2005 判断数据库中是否存在某张表或是查找库中的所有表名,然后删除

来源:互联网 发布:手机京东抢购软件 编辑:程序博客网 时间:2024/05/21 07:58

根据表名的个数判断:
select count(name) as co from sysobjects where name = 'TD_RXNFDM'

查找苦中所有表的表名:
SELECT [name] FROM sysobjects WHERE type='u'

删除某表: 
   if exists (select name from sysobjects where name = '表名')
   drop table 表名

原创粉丝点击