【T-SQL】清空所有表记录的存储过程
日期:2007年9月18日 作者: 查看:[大字体 中字体 小字体]-
天天用,就贴出来吧
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
(出处:网侠)
上一篇:精华:全面接触SQL语法
下一篇:学习SQL语句之SQL语句大全
