>From Microsoft:

After an INSERT, SELECT INTO, or bulk copy statement completes, @@IDENTITY
contains the last identity value generated by the statement. If the
statement did not affect any tables with identity columns, @@IDENTITY
returns NULL. If multiple rows are inserted, generating multiple identity
values, @@IDENTITY returns the last identity value generated. If the
statement fires one or more triggers that perform inserts that generate
identity values, calling @@IDENTITY immediately after the statement returns
the last identity value generated by the triggers. The @@IDENTITY value does
not revert to a previous setting if the INSERT or SELECT INTO statement or
bulk copy fails, or if the transaction is rolled back.

So, you have a trigger that inserts into an audit table with a autoinc
field? out of luck, you get the identity of the audit table, not your table.
There is also a bug where someone else inserting into a table can kill your
@@identity if they trigger an autoinc field, but I can't find my reference
to it - its usually on support.microsoft.com.

N
----- Original Message -----
From: "Neven MacEwan" <[EMAIL PROTECTED]>
To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
Sent: Friday, January 12, 2001 9:34 AM
Subject: Re: RE: [DUG]: [DUG-DB]: Unique IDs


> Paul
>
> > But your second point does concern me.  Basically you're saying that
under
> > stress and with multiple connections, an identity column may return the
> same
> > value twice.  Can you point me to a link that confirms that?  I
understood
> > they were pretty much bullet proof.
>
> Unfortunately not - I haven't had any problems with this but Nic did
> (Nic this is your cue)
>
> Neven
>
>
>
>
>
>
> --------------------------------------------------------------------------
-
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
>

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to