?
Solved

limit and offset clauses

Posted on 2002-04-07
3
Medium Priority
?
2,657 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
[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
3 Comments
 
LVL 10

Accepted Solution

by:
bret earned 200 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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
In this modest contribution, I want to share with the IT community (especially system administrators, IT Support Engineers and IT Help Desks) about Windows crashes/hangs and how to deal with these particular problems.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

801 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