[thelist] Using @@Identity

Ken Schaefer Ken at adOpenStatic.com
Wed Aug 24 03:15:05 CDT 2005


: -----Original Message-----
: From: thelist-bounces-ken=adopenstatic.com at lists.evolt.org
: [mailto:thelist-bounces-ken=adopenstatic.com at lists.evolt.org] On Behalf Of
: Casey
: Subject: Re: [thelist] Using @@Identity
: 
: > a) use Scope_Identity not @@IDENTITY. Books Online tells you why, but
: > basically if you have a trigger on a table that does an insert 
: > into another table, then @@IDENTITY will return the identity in this 
: > second table rather than the table you just inserted into. 
: > Scope_Identity insulates you from this problem
: 
: As stated in multiple previous posts, I was already aware of this.  But
: thanks for the reminder.

Apologies - this wasn't specifically directed at you, and I should have been
more clear. Using @@IDENTITY was mentioned in a number of posts, and instead
Scope_Identity() should be used (unless you specifically wish to use
@@IDENTITY)

: > As for how to do this, I'm 99% certain there is a code sample in ASP.NET
: > Unleashed.
: 
: You may be right.  But I was not able to find it in any of the 1,459
: pages. Yes, I tried the index. Yes, I tried the Table of Contents.

Read Chapter 9. In the second edition of that book, using output parameters
is detailed on page 442. Using @@IDENTITY to return the newly created
identity value is detailed on page 444.

: > Additionally, check out the lists here: www.aspadvice.com lots of good
: > people> to answer ADO.NET and ASP.NET questions.
: 
: Good people.  You mean like your self?

No - not like myself. Other people.

Cheers
Ken


More information about the thelist mailing list