Yes I know Denis, but personally I found this clumsy after generators
because you only get ONE opportunity to retrieve the generator - immediatly
after you insert which has created the identity. With IB you get to select
the generator before you insert anything, and use it through all your
transactions. A generator is available to you directly with IB as against
indirectly with SQL server.
Is this now fixed with 7.0?
As someone else has commented, I prefer to implement this at the client
side, and see no advantage in doing it at the server side.
-----Original Message-----
From: Nic Wise <[EMAIL PROTECTED]>
To: Multiple recipients of list database <[EMAIL PROTECTED]>
Date: Wednesday, 22 September 1999 11:31 AM
Subject: Re: [DUG-DB]: Interbase Generators & Insert statements.
EXCEPT if:
user a: insert into (table with ident)
user b: insert into (table with ident - doesn't have to be the same
table)
user a: select @@identity - result is user B's ident!!!!
Or atleast, it was the case with 6.5. They might have fixed it with 7.0
N
Dennis Chuah wrote:
>
> With SQL Server you can use select @@IDENTITY - the perfect solution ...
no
> need for generators, stored procedures, triggers, etc.
>
> Dennis.
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED]]On Behalf Of Tony Blomfield
> > Sent: Tuesday, 21 September 1999 22:54
> > To: Multiple recipients of list database
> > Subject: Re: [DUG-DB]: Interbase Generators & Insert statements.
> >
> >
> > 1. Single Step - include generator in your Insert value list.
> >
> > but you never know what the Generator value was.
> >
> > 2. You need to know the PK for some other reason eg to
> > populate a child
> > object. No way around using 2 step process here. ie you have
> > to select back
> > the Generator Value first. However, IB is real fast at this.
> >
> > 3. Do it in your before Insert trigger.
> > Same problem as (1)
> >
> > 4. Do it in a stored proc.
> >
> > No one method is the perfect solution. They all have their place.
> >
> > There is no other special single step way to do it.
> >
> > At least their isn't a BDE in the middle, and using FIB to do
> > this is about
> > the thinest solution you can get.
> >
> > Cheers,
> >
> > Tony.
> >
> >
> > -----Original Message-----
> > From: Myles Penlington <[EMAIL PROTECTED]>
> > To: Multiple recipients of list database <[EMAIL PROTECTED]>
> > Date: Tuesday, 21 September 1999 1:30 PM
> > Subject: [DUG-DB]: Interbase Generators & Insert statements.
> >
> >
> > >This must get asked several times ...
> > >
> > >If you are using an generator for a primary key (PK) in
> > conjunction with an
> > >Insert Trigger, is there any way with FIB/IBX/TQuery to get back the
> > >generated PK
> > >value?
> > >
> > >Or do I have to use a Stored procedure to create an new PK
> > value inside the
> > >same transaction and then use that in the SQL insert statement?
> > >
> > >Are there any other methods of doing this?
> > >
> > >I was just looking for a way to do this without doing 2 SQL
> > statements back
> > >to the server (ie the SQL select for the stored
> > procedure/generator and the
> > >SQL
> > >Insert).
> > >
> > >Thanks.
> > >
> > >Myles Penlington
> > >Software Engineer
> > >ADVANCED MANAGEMENT SYSTEMS
> > >
> > >-------------------------------------------------------------
> > --------------
> > > New Zealand Delphi Users group - Database List -
> > [EMAIL PROTECTED]
> > > Website: http://www.delphi.org.nz
> >
> > --------------------------------------------------------------
> > -------------
> > New Zealand Delphi Users group - Database List -
> > [EMAIL PROTECTED]
> > Website: http://www.delphi.org.nz
> >
>
> --------------------------------------------------------------------------
-
> New Zealand Delphi Users group - Database List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
--
Nic Wise - Inprise New Zealand / Brocker Technologies Web Monkey.
mob:+64.21.676.418 - wk:+64.9.481.9999 x9753 - wk-em:[EMAIL PROTECTED]
hm: +64.9.277.5309 - hm-em:[EMAIL PROTECTED]
---------------------------------------------------------------------------
New Zealand Delphi Users group - Database List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
---------------------------------------------------------------------------
New Zealand Delphi Users group - Database List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz