[thelist] limiting search results by number (SQL Server 7)

rudy r937 at interlog.com
Sun Dec 9 07:31:44 CST 2001


> I remember seeing an article on this somewhere which
> used php/mysql but it also used the LIMIT clause, which
> SQL server doesn't apparently support (as far as I can tell).

hi chris

sql/server uses TOP but i'm not sure it's as flexible as LIMIT, since with
LIMIT you can specify a starting row number and i believe TOP always starts
at 1 -- anybody with "bol" (books online) can quickly verify

still, this method is inefficient because it is basically a complete
re-query of the database, only you're not returning all the rows

> Anyone have any tips or advice on how to go about doing this?
> If I choose the full-recordset method I will be returning hundreds
> upon thousands of rows everytime but only showing 21-40 or
> 101-120 (and so on).  I'd really rather not do that.

good thinking, and you are right to be concerned

look into caching the query results

i assume you're using ASP, and i don't know how to do it there, but in cold
fusion there's the CACHEDWITHIN parameter on the CFQUERY tag

rudy






More information about the thelist mailing list