The first method is the most traditional method. The variable in the stored procedure is used as the page multiplier.
CopyCode The Code is as follows: [C-sharp] view plaincopyprint? Create proc p_paged1
@ Pagesize int, @ currentpage int
As
Select top (@ pagesize) * from student
Where id not in
(Select top (@ pagesize * (@ currentPage-1) ID from student)
Go
Exec p_paged1 2, 3
Create proc p_paged1
@ Pagesize int, @ currentpage int
As
Select top (@ pagesize) * from student
Where id not in
(Select top (@ pagesize * (@ currentPage-1) ID from student)
Go
Exec p_paged1 2, 3
-- Paging statement after SQL server2005Copy codeThe Code is as follows: [C-sharp] view plaincopyprint? Create proc p_paged2
@ Pagestart int, @ pageend int
As
Select * from
(Select *, row_number () over (order by id desc) as rnum
From student) T
Where T. rnum between @ pagestart and @ pageend
Go
Exec p_paged2 5, 10