Solved

limit and offset clauses

Posted on 2002-04-07
3
2,643 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Sybase - CronJob schedule 2 591
Installing Sybase IQ 16.x x64 on Windows 8.1 update1 5 1,558
Sybase 15.7 database backup 8 609
install sybase 15.7 over 15.0.x 2 37
Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
A customer recently asked me about anti-malware and the different deployment options available for his business. Daily news about cyberattacks, zero-day vulnerabilities, and companies that suffered a security breach made him wonder if the endpoint a…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

895 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

19 Experts available now in Live!

Get 1:1 Help Now