Subject | Re: [firebird-support] Get the row number in a select |
---|---|
Author | Fabiano Bonin |
Post date | 2008-03-28T18:04:01Z |
I have just figured out my own tricky way :-)
I think it's cheap, multi-user friendly and can be achieved using just
a simple select:
select
rdb$get_context('USER_TRANSACTION', 'row#') as row_number,
rdb$set_context('USER_TRANSACTION', 'row#',
coalesce(cast(rdb$get_context('USER_TRANSACTION', 'row#') as integer),
0) + 1),
a.rdb$relation_name
from
rdb$relations a
order by
a.rdb$relation_name
I think it's cheap, multi-user friendly and can be achieved using just
a simple select:
select
rdb$get_context('USER_TRANSACTION', 'row#') as row_number,
rdb$set_context('USER_TRANSACTION', 'row#',
coalesce(cast(rdb$get_context('USER_TRANSACTION', 'row#') as integer),
0) + 1),
a.rdb$relation_name
from
rdb$relations a
order by
a.rdb$relation_name