Go to my github

SQL server 批量删除表

select 'drop table '+name+';' from sys.tables 



declare c cursor for
select NAME from sysobjects where xtype='U' order by NAME
declare @t varchar(200)
open c
fetch next from c into @t
while @@FETCH_STATUS=0
begin
print('truncate table '+@t)
fetch next from c into @t
end
close c


  

posted @ 2021-05-15 17:32  峡谷少爷  阅读(571)  评论(0编辑  收藏  举报