--use pubs --数据库名 
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('TRUNCATE TABLE ['+@tbname+']'
  
fetch next from #tb into @tbname 
end 
close #tb 
deallocate #tb 
posted on 2008-06-26 17:56  code life  阅读(225)  评论(0)    收藏  举报