Sybase Sql Query for displaying 10 to 20 records (pagination)

Posted on 2007-11-30
Medium Priority
Last Modified: 2012-06-27
Hi Experts,

Can you please help to wrtie a query in sybase database.

For example result Select * from emp returns 100 rows.
I need queries to display first 1 to 20 and another query to display 20 to 40 etc.

Please help me on this.

Question by:gannev
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 10

Expert Comment

ID: 20382899

Author Comment

ID: 20383454
Am a beginner, and am not understanding that.

Can you please write a simple code snippet for
select 10 to 20 records from emp table.

Appreciate your help
LVL 10

Accepted Solution

bret earned 1500 total points
ID: 20383524
select <primary key column>, rownum = identity(20) into #temp from emp
select e.* from emp e, #temp t where
t.pk = e.pk
and t.rownum >= 10
and t.rownum < 21

Author Comment

ID: 20384357
Hi Bret,

Thanks for this solution. It is working greatly. But this would lead me to write procedure.
I need a sql query for this. And I can call that query from my application(java appliction).


Featured Post

Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hey fellow admins! This time, I have a little fairy tale for you. As many tales do, it starts boring and then gets pretty gory. I hope you like it. TL;DR: It is about an important security matter, you should read it if you run or administer Windows …
This month, Experts Exchange’s free Course of the Month is focused on CompTIA IT Fundamentals.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question