declare
@name
varchar
(
20
)
set @name = ' spb_ '
declare cou cursor for
select name from sysobjects where name like N ' % ' + @name + ' % ' and type = ' u '
open cou
FETCH NEXT FROM cou into @name
while @@FETCH_STATUS = 0
begin
exec ( ' drop table ' + @name )
print @name ;
FETCH NEXT FROM cou into @name
end
close cou DEALLOCATE cou
set @name = ' spb_ '
declare cou cursor for
select name from sysobjects where name like N ' % ' + @name + ' % ' and type = ' u '
open cou
FETCH NEXT FROM cou into @name
while @@FETCH_STATUS = 0
begin
exec ( ' drop table ' + @name )
print @name ;
FETCH NEXT FROM cou into @name
end
close cou DEALLOCATE cou