Piotr Czekalski, 27.01.2011 16:21:
> Gentelmen,
>
> I follow this thread and I don't exactly get an idea of yours, but
> isn't is as simple as (example: table "web.files" contains one column
> named "fileurl" ):
>
> select row_number() over(), X.fileurl from (select fileurl from
> web.files order by fileurl) X
>
> The only disadvantage is that if you do want to order resultset you
> have to use "select from select" as numbers are added before order
> which may cause some performance troubles.
>
You can get the row_number() without using the sub-select and without ordering the whole result as you can specify the order in the over() clause:
select fileurl
row_number() over (order by fileurl)
from web.files
Regards
Thomas