Subject Re: [firebird-support] Return integer row_id in record set
Author Thomas Steinmaurer
> I wish to display the ID (of all time points = 0). I can handle this programatically but rather would do in SQL.
>
> The following query returns the time points
>
> SELECT ID as VAL
> FROM x
> WHERE "TIME" = 0
> order by id
>
> The values are
> 87
> 117
> 120
>
> Now, is there a function in FB that will return me an ID (sequential, starting at 1 and increments of 1) for each of the records like so?
>
> ID VAL
> 1 87
> 2 117
> 3 120


Although it might be possible with a mix of RDB$SET_CONTEXT,
RDB$GET_CONTEXT, it's rather easy with a selectable stored procedure.


--
With regards,

Thomas Steinmaurer
Upscene Productions
http://www.upscene.com
http://blog.upscene.com/thomas/

Download LogManager Series, FB TraceManager today!
Continuous Database Monitoring Solutions supporting
Firebird, InterBase, Advantage Database, MS SQL Server
and NexusDB!