0 Replies Latest reply on Feb 18, 2003 10:59 AM by Chris Bono

    DB Paging in SQLServer

    Chris Bono Newbie

      I know that many threads on here have talked about paging implementations in the DB (pull back only records 10-20 for example). I also know that JBoss4.0 will handle this for us. However, in the meantime it is my job to implement this behavior in our current app (JBoss3.0.x).

      From what I have seen, it looks like if your DB supports the LIMIT/OFFSET statements then you can use <declared-sql> to do this. Is that a correct assumption?

      If that works, great. Here is what the sql would look like "select id from table limit 10 offest 10" or something along those lines. Unfortunately for SQLServer you would have a sql statement like

      "select top limit id from table where id not in (select top (limit*offset) id from table)"

      And given that the clause is at the beginning and the end of the statement I am not sure how I would do that with <declared-sql>. Is it possible??

      Thanks,
      Chris