?
Solved

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

Posted on 2007-11-30
4
Medium Priority
?
3,192 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
  • 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 1500 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
This holiday season, we’re giving away the gift of knowledge—tech knowledge, that is. Keep reading to see what hacks, tips, and trends we have wrapped and waiting for you under the tree.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

807 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