Yes, 2005 and up. I've not tested it on 2000 but I believe row_number() came about in 2005.
-----Original Message----- From: Che Vilnonis [mailto:[email protected]] Sent: Thursday, March 25, 2010 9:06 AM To: cf-talk Subject: RE: how to incremently fetch data Bobby, this code is for SQL 2005 and newer right? I'm on SQL 2000 (yeah, I know...lame) and I've never been able to find a solution that works. ~Che -----Original Message----- From: Bobby Hartsfield [mailto:[email protected]] Sent: Thursday, March 25, 2010 8:59 AM To: cf-talk Subject: RE: how to incremently fetch data Here is a SQL Server method ive used for paged results. Just tell it how many results per page and what page you are on. The example assumes 25 results and page 3 of those results DECLARE @PageNum AS INT; DECLARE @PageSize AS INT; SET @PageNum = 3; SET @PageSize = 25; WITH articlesRN AS ( SELECT ROW_NUMBER() OVER(ORDER BY articleDate desc) AS RowNum , * FROM tblArticles ) SELECT * FROM articlesRN WHERE RowNum BETWEEN (@PageNum - 1) * @PageSize + 1 AND @PageNum * @PageSize ORDER BY articleDate desc; -----Original Message----- From: Bobby Hartsfield [mailto:[email protected]] Sent: Thursday, March 25, 2010 7:45 AM To: cf-talk Subject: RE: how to incremently fetch data Which database server are you using? -----Original Message----- From: sandeep saini [mailto:[email protected]] Sent: Thursday, March 25, 2010 12:15 AM To: cf-talk Subject: how to incremently fetch data Hi, I run some query and per say fetch 100 records. now i run other query which fetch 150 records. I want that just 50 records be actually fetched in second round from database. How can this be possible? fyi- i am using MachII for my application. Thanks. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:332248 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

