SQLserver 实现批量删除表语句

declare @name varchar(30) ; declare cur cursor for select name from sysobjects where xtype='U' and name like 'R_ZW%' ; open cur; while 1=1 begin fetch next from cur into @name; if (@@fetch_status = -1) break; exec ('drop table ASUser.'+@name); print @name; end; close cur; deallocate cur;

你可能感兴趣的:(table,sqlserver)