# SQL server 2000 - all pages are the same

**URL:** <https://www.ruby-forum.com/t/sql-server-2000-all-pages-are-the-same/71716>\
**Category:** Rails\
**Created:** [October 10, 2006, 11:57pm UTC](https://www.ruby-forum.com/t/sql-server-2000-all-pages-are-the-same/71716 "2006-10-10T23:57:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gertone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e480ec/32.png) [@Gertone](https://www.ruby-forum.com/u/Gertone)\
**Post date:** [October 10, 2006, 11:57pm UTC](https://www.ruby-forum.com/t/sql-server-2000-all-pages-are-the-same/71716/1 "2006-10-10T23:57:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Gertone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e480ec/32.png) [@Gertone](https://www.ruby-forum.com/u/Gertone)\
**Post date:** [October 11, 2006, 9:20am UTC](https://www.ruby-forum.com/t/sql-server-2000-all-pages-are-the-same/71716/2 "2006-10-11T09:20:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Gertone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e480ec/32.png) [@Gertone](https://www.ruby-forum.com/u/Gertone)\
**Post date:** [October 11, 2006, 12:19pm UTC](https://www.ruby-forum.com/t/sql-server-2000-all-pages-are-the-same/71716/3 "2006-10-11T12:19:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Gertone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e480ec/32.png) [@Gertone](https://www.ruby-forum.com/u/Gertone)\
**Post date:** [October 12, 2006, 12:48am UTC](https://www.ruby-forum.com/t/sql-server-2000-all-pages-are-the-same/71716/4 "2006-10-12T00:48:19Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![Gertone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/e480ec/32.png) [@Gertone](https://www.ruby-forum.com/u/Gertone)\
**Post date:** [October 12, 2006, 11:00am UTC](https://www.ruby-forum.com/t/sql-server-2000-all-pages-are-the-same/71716/5 "2006-10-12T11:00:54Z")

</div>

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](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
