Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2007
    Posts
    3

    Unanswered: Paging in Sqlserver 2000

    Hello
    If i have a select query and i need to get it result by paging(for example from row x to row y ) without using cursor .
    Is there any way to do it ?

    Nb : like ROW_NUMBER in SqlServer 2005 and ROWNUM oracle.

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    There are several methods for doing this. Which is most efficient depends upon your specific circumstances.

    One method involves fabricating a rownumber with a subquery. This can be done as a single SQL statement (like a view) but is not very efficient.

    Another method is to use nested TOP statements. This method is reasonably fast, but when calling TOP N the N cannot be a variable. So you must either hard-code it or use dynamic sql.

    One more method is to select your data into a temporary table with a defined identity value. You can use the identity values created as row numbers. This method is fairly fast, but requires multiple steps and so must be implemented as a procedure.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •