Sqlserver删除多表操作

DECLARE c2 cursor for
    select 'drop table ['+name +']; '
    from sysobjects
    where xtype = 'u' and name not like 'TRT_%'
open c2
declare @c2 varchar(8000)
fetch next from c2 into @c2
while(@@fetch_status=0)
    begin
        exec(@c2)
        fetch next from c2 into @c2
    end
close c2

猜你喜欢

转载自ch-dj.iteye.com/blog/2158334