最近做数据转移,由于误操作,在系统表master表里创建了N多表 实在是没法删
找到以下方法共享一下
--指定要删除的数据库中的表 use master go declare @sql varchar(8000),@TableName varchar(100) begin declare cur cursor for select Name from sysobjects where xtype=‘p‘ and crdate>=‘2015-03-31 10:33:14.663‘ open cur fetch next from cur into @TableName while @@fetch_status=0 begin set @sql=‘drop table ‘[email protected] --DROP DEFAULT PROCEDURE exec (@sql) fetch next from cur into @TableName end close cur deallocate cur end --select * from sysobjects where xtype=‘p‘ order by crdate
时间: 2024-10-10 17:04:28