Yukon and Paging (Finally)

By patrickwellink
August 16, 2005
1

Ok we probably all had the problem once that we had to build a Grid and a pager in an ASP.WEB site. Now Yukon finally supports paging through data.
I had a look at it in the Yukon CTP and I am almost impressed. (it should have been there in the first release of SQL server 6.5)

Here is how it works :

CREATE PROCEDURE PERSON_PAGER
(@PAGENUM INT, @PAGESIZE INT = 100)
AS
SELECT
* FROM
(
    SELECT ROW_NUMBER() OVER (ORDER BY PERSON_ID ) AS ROW_NUM
    ,PERSON_ID, FIRST_NAME, PREFIX, LAST_NAME, ADDRESS, ZIP, DATE_OF_BIRTH, PHONEPROPERTIES, PERSONPROPERTIES
    FROM PERSONS
) AS RES
WHERE
   
ROW_NUM BETWEEN (@PAGESIZE * @PAGENUM (@PAGESIZE 1)) AND (@PAGESIZE * @PAGENUM )
ORDER BY
  
PERSON_ID

And Presto we have a pager ……..

Comments: 1

  1. Mischa Kroon says:

    Still looks a bit complicated… I would think they could just implement it in the same way as mysql paging.

Comments are closed.

  • Recent Posts
  • Recent Comments
  • Archives
  • Categories
  • Meta