declare @str varchar(120)
set @str= 'insert into #Tmp(ID,Time,Analys,Flag) select top ' + cast(@RecordCount as varchar) + ' ID,Time,Analys,Flag FROM t_sample1 WHERE ShiftID='KK' and NameID='+@NameID+' ORDER BY Time DESC'
exec (@str)
120太小,改为2000试试