Subject Re: FIRST/TOP/LIMIT/ROWNUM - Proposals
Author Syarzhuk Kazachenka
Fred Toussi wrote:

>It seems the only use of FIRST n or TOP n is in interactive queries
>during development. You want to see quickly if your query returns any rows
>at all, or examine the formatting of returned columns.
Not true. I can think of at least two more examples:
1) Suppose I'm using a full-text search add-on and it gives me a calculated
column with estimated relevancy of the result (from 0 to 100). I might just
say "order by relevancy descending and give the user first 20 records,
because others are probably not relevant to her search":
SELECT FIRST 20 * FROM TableName ORDER BY Relevancy(UserSearchStr) DESC

2) Suppose I want to see my 10 best sales agents:
SELECT FIRST 10 LastName FROM SalesAgents ORDER BY YearlySales DESC

>One could make use of ROWNUM as described above to issue one query to
>return the first row of each page that would be returned in chunks.
Yes, but this way you would be putting more logic in the application and
less in SQL. With the LIMIT you could just request a page at a time


Be healthy, stay wealthy...

Visit Belarusan Music Source -

Get your FREE download of MSN Explorer at