No way that you need to resort to stored procedures... It's just a bit nasty to do especially if you want to sort on every column. Basically the technique is about 20 years old.
You need a special datamodel, which stores the key-information of the first and the last record. When you need the next few records you make something like: Select top AAA --column-names-- from table where (--your selection criterias) and (key_column_1 >= last_key_column_1 and key_column_2 >= last_key_column_2) Hope you can see the pattern. hth Alexander ________________________________ From: Yee CN [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 04, 2006 5:29 PM To: 'MyFaces Discussion' Subject: RE: SQL paging with dataScroller You have to resort to stored procedures to do paging with Microsoft SQL server. This is an example: http://weblogs.asp.net/pwilson/archive/2003/10/10/31456.aspx. Maybe you should consider MySQL? It offers a very convenient "Limit offset, limit" clause for paging. Regards, Yee ________________________________ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, 3 January 2006 9:37 PM To: users@myfaces.apache.org Subject: RE: SQL paging with dataScroller Paging at the database level is feasible sometimes natively but it depends what you are using. For example, it's easy with Oracle but not with SQL Server natively. However, that means that any changes in sorting dynamically require reordering your recordset to output it properly. In this case, depending how it's done, it could mean running the query again with a different SORT clause, which means it could be pretty less efficient than keeping a map/list of results in a "buffer" that you just play with. But of course different cases call for different solutions. Maybe you can elaborate a bit on what you want to do exactly and what you need to provide (sorting, size of recordsets, etc...)? If it applies, then I think it should be fairly easy to implement using a datascroller that is plugged on a bean method that retrieves the required data on get() probably? I've never personally done it but I believe some people do it here. Greg -----Original Message----- From: Rafael Nami [mailto:[EMAIL PROTECTED] Sent: Tue 1/3/2006 8:23 AM To: MyFaces Discussion Cc: Subject: SQL paging with dataScroller