Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2007
    Location
    Chennai, TN
    Posts
    68

    Unanswered: Query to get the Nth row using sybase

    hi,
    i need a query to get the Nth record in a table?

    Example
    50 aa aaaa
    76 bb bbnn
    56 cc jjjjjjj
    45 xx hhhh

    in the above table, i need a query to get only the 3rd row (i.e)
    56 cc jjjjjjj

  2. #2
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    Data in a relational database has no inherent order.
    Why do you need the Nth row? just use its unique key.
    You should not be relying on the concept of a "row number"
    But you can try using an identity column

  3. #3
    Join Date
    Feb 2007
    Location
    Chennai, TN
    Posts
    68
    Thank you. but i thought, this methodology would help me to remove cursors in stored procedure so that i can iterate row by row for a table which has no primary key or identity column.

Posting Permissions

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