Subject | Re: [firebird-support] Serial number in a query result |
---|---|
Author | Thomas Steinmaurer |
Post date | 2011-03-25T07:15:29Z |
> On 25-03-2011 12:02 PM, Thomas Steinmaurer wrote:I hope you won't create a mass of generators for that purpose?
>>>> A throw-away SEQUENCE would also do the trick, I think:
>>>>
>>>> sql> create sequence AdHoc;
>>>> sql> select next value for AdHoc as SrNo, d.* FROM (...) d;
>>>>
>>>> -Mike
>>>>
>>>>
>>> This is exactly what I want.
>> Needless to say, if the generator/sequence is used by multiple users,
>> then this isn't safe.
>>
>>
> And also, it will exhaust after 32000 queries am i right (if a new
> sequence is used every time)?
A sequence/generator returns a 64-bit integer, so you won't run out of
generator values in your life-time-. ;-)
--
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!