Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2002
    Posts
    3

    Question Unanswered: Sybase Rowset Limitation Optimisation

    Does anyone know if any version of ASE can do Rowset Limitation Optimisation on a Select statement?

    If any what's the syntax?

    As far as I know, Oracle and MySQL have this capability, it's very handy and fast when you only want to return a subset of the resultset, i.e. when give user options to go between result pages.
    for MYSQL the string should be
    "LIMIT %offset% , %maxrecord%"
    for ORACLE the string should be
    "ROWNUM >= %offset% AND ROWNUM <=%endrecord%"

  2. #2
    Join Date
    Jun 2002
    Location
    Argentina
    Posts
    78
    This is from "Reference Manual":

    -----------------------------------------------------------------
    set {rowcount number, textsize number}

    rowcount causes Adaptive Server to stop processing the query (select, insert, update, or delete) after the specified number of rows are affected. The number can be a numeric literal with no decimal point or a local variable of type integer. To turn this option off, use:
    set rowcount 0
    -----------------------------------------------------------------

    Try this:

    set rowcount 10

    select * from ...

    set rowcount 0

    Remember:
    Sybase is not Oracle, in Sybase is better don't use a cursor, and you must think in sets of rows (In the beginning is hard). Try to find a "where" clause that work.

    Good luck!!

    Sebastian

  3. #3
    Join Date
    Mar 2002
    Posts
    3
    thanks svelasco, but I'm actually using sybase jdbc jconnect5.5 to talk to the database. The Query Statement I'm passing to Sybase already defined a where clause that works for me, it's just that it returns 1000 records, I only want my web front end to display 100 per page, and split all record to 10 pages. I can't think of how to modify the where clause to make it only return a chunk of results at a time.. Any idea?

  4. #4
    Join Date
    Mar 2001
    Location
    Lexington, KY
    Posts
    606

  5. #5
    Join Date
    Mar 2002
    Posts
    3
    Thanks, Matt! Using Temp table solves my problem..

Posting Permissions

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