create proc P_RandRecord @tablename varchar(25)
as
exec('select identity(int,1,1) as idd,* into #t from '+@tablename)
select * into #t1 from #t where 1=2
declare @n int
set @n=0
while @n<>10
begin
insert into #t1 select * from #t where idd=(cast(rand()*100) as int)
@n=@n+1
end
select distinct top 10 * from #t1