Paging is much easier and faster in SQL Server 2011. Here is the Stored Procedure for paging which gets two parameters as input; @PageNumber and @RowsPerPage
CREATE PROCEDURE SQL_2011_PAGING ( @PageNumber INT, @RowsPerPage INT ) AS SELECT No, Name, Surname, Class FROM dbo.Students ORDER BY No OFFSET (@PageNumber-1) * @RowsPerPage ROWS FETCH NEXT @RowsPerPage ROWS ONLY GO |
If you use SQL Server 2008 or earlier versions, you can read the article I’ve written before; Simple stored procedure for paging
Special thanks to Turgay



Şener Akdemir
April 24, 2011 at 2:52 PM
Hocam bu sayfalama SQL SERVER 2008 ‘ de var mı?
Mehmet
April 24, 2011 at 3:01 PM
Maalesef, SQL 2008′de çalışmaz.
SQL 2008′de sayfalama için http://www.susakli.com/index.php/simple-stored-procedure-for-paging/ makalesinden faydalanabilirsiniz.