删除数据库中所有表,存储过程

use 数据库名称
declare @tname varchar(8000)
set @tname=''
select @tname=@tname + Name + ',' from sysobjects where xtype='U'
select @tname='drop table ' + left(@tname,len(@tname)-1)

print @tname
exec(@tname)
go

use 数据库名称
declare @tname varchar(8000)
set @tname=''
select @tname=@tname + Name + ',' from sysobjects where xtype='P'
select @tname='drop Procedure ' + left(@tname,len(@tname)-1)

print @tname
exec(@tname)
go

上一篇:Arduino --structure


下一篇:【Oracle_SQL】oracle常用连接