你可以把要显示的条数作为参数,
exec (‘select top ’+cast(@pagesize as varchar(3))+ ' ry from lwmain where xjsj between '"+time1+"' and '"+time2+"' order by id")