日期:2014-05-16  浏览次数:20401 次

sql server 删除数据库的所有表

declare mycur cursor local for select [name] from dbo.sysobjects where xtype='U' and left([name],4)='abcd'
declare @name varchar(100)

OPEN mycur

FETCH NEXT from mycur into @name

WHILE @@FETCH_STATUS = 0

BEGIN
exec('drop table ' + @name)
FETCH NEXT from mycur into @name
END

CLOSE mycur