Subject Re: Slq Server @@IDENTITY equivalent in FB
Author Adam
--- In firebird-support@yahoogroups.com, Vlad Orlovsky <vmo3d@...> wrote:
>
> Hi Adam,
>
> It think this is exactly what I'm looking for:
>
> INSERT INTO ... VALUES (...) [RETURNING <column_list>
> [INTO
> <variable_list>]]
>
> I really don't want to use GEN_ID(AS_USERS_SEQ, 0)
> because I want the trigger take to care of this
> operation.

The problem with looking at the current value of the generator (using
an increment of 0 with gen_id as you have described) is that you can
not be sure that in between your trigger firing and you querying the
current value that someone else has not incremented the generator. In
other words, in a multi-user environment, it might return the wrong
number.

>
> Should I upgrade to Fb 2.0? I think my port may take
> another month...

I would say no.

Firebird 2 is a beta (RC4).

Would you be kicking and screaming if it is not considered stable when
you wish to release? There is going to be *** at least *** 1 more
release candidate before Firebird 2 is considered stable.

Or another way to look at it, if you were porting your application to
windows, would you use features that will only be available in Vista?
Of course not.

The current stable build of Firebird is 1.5.3, so it would be unwise
to bank your product on what may or may not be ready in another month.

Given that the feature you want can indeed be implemented in Firebird
1.5 (although not the way you prefer), I would personally stick to
that, knowing that in the future you can change your application logic
to the more efficient insert into statement that returns the (autoinc)
value.

Adam