|
|
SQL SERVER Paging - Method 2
Pagination is the technique to display data when there is more data than it is possible to put on one screen. Paging can either be done at the “Application level” or at the “Database level”.In the past, developers would have to design stored procedures to accomplish paging using temp tables, or would have to return the entire result set back to the client and page the data set in that fashion. Here 2 simple methods are explained which can accomplish paging at the Database level. Method 2 create procedure Paging_Sp2
exec Paging_Sp2 15,3 Description
This procedure is using a new sql 2005 function "ROW_NUMBER()",for generating row numbers. Here the "rownum" and all the fields of the products table are initially pushed in to a derived table "Products_T" (A derived table is one that is created on-the-fly using the SELECT statement, and referenced just like a regular table or view ).The Products_T table is used for further data retrieval by checking the row number.
|



