declare c cursor for select NAME from sysobjects where xtype=‘U‘ declare @t varchar(200) open c fetch next from c into @t while @@FETCH_STATUS=0 begin exec(‘truncate table ‘+@t) fetch next from c into @t end close c
原文:https://www.cnblogs.com/bihuijia/p/14704566.html