W~C停用

导航

清除数据库中所有表的数据,不删除表

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

 

posted on 2021-04-26 14:41  W~C停用  阅读(236)  评论(0编辑  收藏  举报