create proc p_存储过程名
@当前页 int,@每页显示多少条 int
as
select * from (select *,ROW_NUMBER() over(order by id) as 排序 f rom (表名)) a
where 排序 between (@当前页-1)*@每页显示多少条+1 and @当前页*@每页显示多少条
go
本文介绍了一个使用T-SQL创建的存储过程,该过程用于实现数据库查询的分页功能。通过传递当前页数及每页显示的记录数作为参数,可以有效地获取指定页的数据。此方法适用于需要对大量数据进行分页展示的应用场景。
create proc p_存储过程名
@当前页 int,@每页显示多少条 int
as
select * from (select *,ROW_NUMBER() over(order by id) as 排序 f rom (表名)) a
where 排序 between (@当前页-1)*@每页显示多少条+1 and @当前页*@每页显示多少条
go

被折叠的 条评论
为什么被折叠?