SQL Server 如何删除数据库所有用户表?
来源:程序员人生 发布时间:2014-03-10 16:47:25 阅读次数:3103次
sqlserver 查询分析器里面执行即可
DECLARE curItems CURSOR
FOR select [name] from sysobjects where xtype='U'
FOR READ ONLY
OPEN curItems
DECLARE @n NVARCHAR(100),@m NVARCHAR(100)
FETCH FROM curItems INTO @n
WHILE @@FETCH_STATUS=0
BEGIN
set @m=@n
exec('Drop Table ' + @m)
FETCH NEXT FROM curItems INTO
@n
END
CLOSE curItems
DEALLOCATE curItems
生活不易,码农辛苦
如果您觉得本网站对您的学习有所帮助,可以手机扫描二维码进行捐赠