分页存储过程

alter proc usp_Fen
@yema int,
@tiaoshu int,
@count int output
as 
begin
	set @count=(select COUNT(*) from MyStudent) 
	select top (@tiaoshu) * from (select *,ROW_NUMBER() over(order by fid asc ) as rownum from MyStudent ) as t   
	where t.rownum  between @tiaoshu*(@yema-1)+1  and  @tiaoshu*@yema  	
end
原文地址:https://www.cnblogs.com/mingjian/p/3413364.html