ITeye博客

游历数据库内所有名字符合条件的表

flon · 2009-11-06 13:58 · Markdown

declare @cur varchar(50)
declare curname cursor
for
select name from test.dbo.sysobjects where name like 'web_supply_%' or name like'sj_%'
open curname
fetch next from curname into @cur
while @@fetch_status=0
begin
declare @strSql varchar(500)
set @strSql='drop table '+ @cur
exec( @strSql)
fetch next from curname into @cur
end
close curname
deallocate curname

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。