create proc test (@id int)
as
declare @strsql varchar(4000)
select @strsql=
'select top 5 N_id,N_title,N_content
from (select top 5 N_id
from (select top '+cast(@id*5 as varchar(5))+' N_id
from tablename
order by N_id) c
where c.N_id>(select isnull(max(N_id),(select min(N_id) from tablename))
from (select top '+cast((@id-1)*5 as varchar(5))+' N_id
from tablename order by N_id) d)
order by N_id desc) a, tablename b
where b.N_id= a.N_id
order by a.N_id'