Re: How do I read back autonumber after do an insert in asp.net
- From: Lucas Tam <REMOVEnntp@xxxxxxxxxx>
- Date: Wed, 10 Aug 2005 21:45:31 GMT
"T. DAVIS JR" <someone@xxxxxxxxxxx> wrote in
news:evSwa7enFHA.1048@xxxxxxxxxxxxxxxxxxxx:
> Well it depends on what database you are using. If you are using SQL
> Server this should work:
>
> SELECT @@Identity
@@IDENTITY is potentially a BAD thing! SELECT SCOPE_IDENTITY() is a
better choice since @@identity could return the wrong value if there are
triggers on the table.
Example:
http://www.trigonblue.com/sp_identity.htm
Here's a table explaining the difference:
SELECT @@IDENTITY <- Session Scope
SELECT IDENT_CURRENT('tablename') <- Table scope
SELECT SCOPE_IDENTITY <- statement scope
In detail:
http://www.sqlteam.com/item.asp?ItemID=319
--
Lucas Tam (REMOVEnntp@xxxxxxxxxx)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
.
- Follow-Ups:
- Re: How do I read back autonumber after do an insert in asp.net
- From: T. DAVIS JR
- Re: How do I read back autonumber after do an insert in asp.net
- References:
- How do I read back autonumber after do an insert in asp.net
- From: COHENMARVIN
- Re: How do I read back autonumber after do an insert in asp.net
- From: T. DAVIS JR
- How do I read back autonumber after do an insert in asp.net
- Prev by Date: Re: How to call a Sub function from .ASPX file ?
- Next by Date: Re: How to call a Sub function from .ASPX file ?
- Previous by thread: Re: How do I read back autonumber after do an insert in asp.net
- Next by thread: Re: How do I read back autonumber after do an insert in asp.net
- Index(es):
Relevant Pages
|
Loading