Solved

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

Posted on 2007-11-30
4
2,665 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
Comment Utility
0
 

Author Comment

by:gannev
Comment Utility
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
Comment Utility
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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

HOW TO: Install and Configure VMware vSphere Hypervisor 6.5 (ESXi 6.5), Step by Step Tutorial with screenshots. From Download, Checking Media, to Completed Installation.
Veeam Backup & Replication has added a new integration – Veeam Backup for Microsoft Office 365.  In this blog, we will discuss how you can benefit from Office 365 email backup with the Veeam’s new product and try to shed some light on the needs and …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

728 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now