您的位置:首页 > 数据库

清空数据库里所有的表的数据

2008-05-07 16:53 295 查看

use 你要清空的库


go


declare @tbname varchar(250)


declare #tb cursor for select name from sysobjects where objectproperty(id,'IsUserTable')=1


open #tb


fetch next from #tb into @tbname


while @@fetch_status=0


begin


exec('delete from ['+@tbname+']')


fetch next from #tb into @tbname


end


close #tb


deallocate #tb

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: