データベース操作で指定した文字の先頭のテーブルを削除する方法


。 。

。 FOM ,

, 。

create procedure mypro(@bianliang varchar(100))
as
begin
declare @biao varchar(100),@sql varchar(1000)
set @sql='%'+@bianliang+'%'
declare c cursor for select name from sysobjects where type='u' and name like @sql
set @sql='drop table '
open c
fetch c into @biao
while @@fetch_status=0
begin
     set @sql=@sql+@biao
     exec(@sql)
     set @sql='drop table '
     fetch c into @biao 
end
close c
deallocate c
return
end