create procedure ClearTables
as begin
declare @sql varchar(255)
declare @name varchar(30)
create table #names ( name varchar(30) )
insert into #names
select name from sysobjects (nolock)
where type = 'u'
set rowcount 1
while @@error = 0 begin
select @name = name from #names
delete from #names if @@rowcount < 1 break
select @sql = 'truncate table ' + @name
exec ( @sql )
end
set rowcount 0
return (0)
end
GO