Solved

limit and offset clauses

Posted on 2002-04-07
3
2,634 Views
Last Modified: 2008-03-17
Hi

I am migrating a mySQL application to Sybase. What is the equivalent SQL in Sybase for the LIMIT OFFSET clauses? ie to select 5 rows (limit) starting from the 10th row (offset).

Keith
0
Comment
Question by:keithcsl
3 Comments
 
LVL 10

Accepted Solution

by:
bret earned 50 total points
ID: 6924389
There is no direct equivalent.

You can use "set rowcount <x>" to limit the results of a query to <x> rows, but there is no offset.

You can also select the result set (full or limited by SET ROWCOUNT) into a temptable, adding
an identity column, then use the values in the identity column to select subsets:

select a,b,c, rownum = identity(8) into #foo from mytable
select * from #foo where rownum between 10 and 15
drop table #foo
go
0
 
LVL 6

Expert Comment

by:ChrisKing
ID: 9947788
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: bret

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

ChrisKing
EE Cleanup Volunteer
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
ORCA Powerbuilder import 7 1,028
Sybase - CronJob schedule 2 582
Sybase conversion 2 61
Executing multiple sybase statements in perl dbi 2 85
In this step by step tutorial with screenshots, we will show you HOW TO: Enable SSH Remote Access on a VMware vSphere Hypervisor 6.5 (ESXi 6.5). This is important if you need to enable SSH remote access for additional troubleshooting of the ESXi hos…
We have come a long way with backup and data protection — from backing up to floppies, external drives, CDs, Blu-ray, flash drives, SSD drives, and now to the cloud.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

707 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

20 Experts available now in Live!

Get 1:1 Help Now