sql删除数据库所有表

use 数据库名(是要删除表的所在的那个数据库的名称)
GO
declare @sql varchar(8000)
while (select count(*) from sysobjects where type='U')>0
begin
SELECT @sql='drop table ' + name
FROM sysobjects
WHERE (type = 'U')
ORDER BY 'drop table ' + name
exec(@sql) 
end-----------------------------------------------use 数据库一定要填对哦......

 

posted @ 2014-08-15 09:57  James·wang  阅读(472)  评论(0编辑  收藏  举报