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

Reply via email to