标签:
删除包含指定字符串的表
create procedure sys_DeleteTableByTableName(@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
执行方法:
EXEC sys_DeleteTableByTableName ‘StuInfo_Backup_2015‘
标签:
原文地址:http://www.cnblogs.com/LouieZone/p/4525119.html