Rafael Lenartowicz
3/21/2007 5:15:00 PM
I'm not sure if 2000 supports it, but in 2005 it's very simple:
SELECT ROW_NUMBER ( ) OVER(ORDER BY your_order_column) ,
other_columns_you_want_to_select FROM tablename WHERE... etc.
"sali" <sali@euroherc.hr> wrote in message
news:OsY7IY9aHHA.4012@TK2MSFTNGP03.phx.gbl...
> sql2000
> is there some clever way to enumerate records in ordered query, so the
> enumeration reflects the order of records in query?
>
> one option is to use cursor to traverse the result set, but is too slow
>
> easy example could be, f.e.:
>
> set @recno_new = @recno_last +1
>
> executed for each row, but it is hard [imposisible] to implement. that
> approach needs some global [or static] variable, but there is no such
> type.
>
> any comment?
>
> thnx.
>
>
>
>
>