CREATE   PROCEDURE   dropTable @tableName varchar(40)
AS 
declare cur cursor read_only 
for select distinct table_name from information_schema.columns where table_name like @tableName

declare @name varchar(40),@sql varchar(1000
open cur

fetch next from cur into @name 
while (@@fetch_status =0
begin 
set @sql ='drop table ' + @name 
exec (@sql)

fetch next from cur into @name 
end

close cur 
deallocate cur 
go

相关文章:

  • 2022-12-23
  • 2021-11-30
  • 2021-07-21
  • 2021-12-10
  • 2021-06-01
  • 2022-02-21
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-30
  • 2021-11-30
  • 2021-08-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案