天天用,就贴出来吧
use 你要清空的库godeclare @tbname varchar(250)declare #tb cursor for select name from sysobjects where objectproperty(id,'IsUserTable')=1open #tbfetch next from #tb into @tbnamewhile @@fetch_status=0begin exec('delete from ['+@tbname+']') fetch next from #tb into @tbnameendclose #tbdeallocate #tb