Please be aware that the SAP SQL Anywhere Forum will be shut down on August 29th, 2024 when all it's content will be migrated to the SAP Community.

I'm coming over from the MSSQL world and have gotten used to things like Skip to help with paging.

From what I can gather Skip isn't supported with the iSqlAnywhere provider so the only way I can think of off the top of my head are to use my filtered IQueryable to bring back primary keys and perform a skip take on them in memory and then do a contains to bring back the actual data I need.

To me this seems kind of hacky and I would definitely appreciate any other thoughts on the matter.

Writing SQL statements directly is not an option.

Here is an example of what I'd be doing.

IQueryable<foo> bar =  someAlreadyFilteredQueryable;
var barIds = bar.Select(b=>b.Id).ToList();
var finalIds = barIds.Skip(pageNum * pageSize).Take(pageSize);
var result =  someAlreadyFilteredQueryable.Where(s=> finalIds.Contains(s.Id)).ToList();

Like I said it seems hacky considering I can just do someAlreadyFilteredQueryable.Skip(pageNum * pageSize).Take(pageSize).ToList() with MSSQL.

Edit: It appears the query generated behind the scenes uses the ALL keyword that isn't supported in the version of sybase I'm hitting.

TLDR - You need to be on V12 to use Skip

asked 13 Aug '13, 17:38

elindalyne's gravatar image

accept rate: 0%

edited 15 Aug '13, 10:22

Skip is supported. I use it in my code all the time.


For example, here's some code from my program that performs a paged search of one of the tables in our database:

noPages = (int) ( noMatchingEntries / pageSize );
if ( noMatchingEntries % pageSize != 0 )

if ( pageNo > 0 ) {
    query = query.Skip( pageNo * pageSize );

query = query.Take( pageSize );
permanent link

answered 14 Aug '13, 09:26

TonyV's gravatar image

accept rate: 75%

edited 15 Aug '13, 08:20

Can you give me an example? What version are you running?

Every time I attempt to do so I get a syntax error - 'Syntax error near 'ALL' on line 6'

(14 Aug '13, 10:23) elindalyne
Replies hidden

What SA version are you using?

(14 Aug '13, 10:33) Reimer Pods

It appears this particular DB is on

(14 Aug '13, 10:34) elindalyne

We're using SA We're also using the same version of the SA ADO.NET / Entity Framework driver. See the edits to my answer for an example.

(15 Aug '13, 08:18) TonyV
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 13 Aug '13, 17:38

question was seen: 3,558 times

last updated: 15 Aug '13, 10:22