SQL server 2000 - all pages are the same

Hi, did anyone ever came across this?

I have a very complex SQL Server 2000 database
And I created a bunch of complex views to
make access of some information easier
and have “tables” that have ROR like naming

All I have to do is get information from the DB, I never have to write
into it using Rails

Now If I get a page (10 records by default) just original scaffold,
nothing changed
All the pages are the same, the number updates, but the content doesn’t
differ
if I change the default to 20 records, I get the 20 first records
correctly,
but next page gives me the same 20 records

Any ever seen this and knows where I have to start looking?

Thanks

Geert

Try adding an ordering to your query. The SQL Server adapter doesn’t
handle pagination very well, and can fail completely where there is no
ordering on the query.

Tom

Yes I ran into the same problem - you need to specify ordering in the
paging code. This is because SQL does not support LIMIT like MySQL.

Hi guys, thank you
I already saw some weird things in the SQL in the log file
twice TOP isn’t rocking :slight_smile:

here is my simple standard list code
def list
@vamp_artefact_pages, @vamp_artefacts = paginate :vamp_artefacts,
:per_page => 10
end

how do I order this, in the paginate methods definition?
thanks for your help

Geert

well, solution is simple aparently

def list
@vamp_artefact_pages, @vamp_artefacts = paginate :vamp_artefacts,
:per_page => 10, :order =>“id”
end

I also found on http://dev.rubyonrails.org/ticket/3437
that solving this in the sql server adapter is a bit tricky

Thank you both for pointing me in the right direction

Geert