Go to my github

批量删除数据库表数据 备份

批量删除数据库表数据  备份

 

 
--批量删除数据库表数据
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  ['+@tbname+']')
  fetch next from #tb into @tbname
end
close #tb 

deallocate #tb 

posted @ 2011-11-17 09:05  峡谷少爷  阅读(257)  评论(0编辑  收藏  举报