Subject Re: [firebird-support] Re: ROWNUM
Author emel.hu
Adam írta:
>
> That would work, but depending on what they want, you may need to
> reset it every go. It is not a threadsafe (because generators are not
> isolated to your transaction), so your numbers aren't guaranteed to
> be sequential, though they will be unique unless someone resets the
> generator.
>
> I would suggest implementing the row number in the client
> application, or if it really needs to be on the db server, then use a
> stored procedure to create it.
>
> Adam
>
>
>
>>A roundabout way:
>>
>>select gen_id(ROWNUM_COUNTER, 1) as ORDER, TITLE FROM BOOK ORDER BY
>
> 1"

Why need you for ORDER starting 1?
Generators are int64;) It can go to very big;))
I use it for technical number (example: for dxDBGrid->KeyField) if I
can't use RDB$DB_KEY (example: group by).

You can use only stored procedure for exact one started ORDER field, but
it slower then gen_id.

eMeL