清除数据库数据

清除数据表多了麻烦,找了个删除数据的sql,忘了在哪找的了,做个记录

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 @ 2020-11-24 16:37  物语007  阅读(61)  评论(0)    收藏  举报