Solved

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

Posted on 2007-11-30
4
2,943 Views
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.

Thanks,
Ganne
0
Comment
Question by:gannev
[X]
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
4 Comments
 
LVL 10

Expert Comment

by:bret
ID: 20382899
0
 

Author Comment

by:gannev
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
0
 
LVL 10

Accepted Solution

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

Author Comment

by:gannev
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).

Thanks,
Ganne
0

Featured Post

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

The conference as a whole was very interesting, although if one has to make a choice between this one and some others, you may want to check out the others.  This conference is aimed mainly at government agencies.  So it addresses the various compli…
Multi-threading long-running processes can have a significant increase in overall performance and drastically decrease over time it takes for a process to complete. Unfortunately, not all applications support native multi-threading, some by design a…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

726 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