Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieve new autonumber_ID from stored procedure 1

Status
Not open for further replies.

dirkg

Technical User
May 20, 2000
170
BE
Hi,

I have a table which holds a single key ID. ID is an autonumber. I wonder whether it is possible to retrieve the newly assigned ID from a record directly as a return value from the stored procedure I use to append the new record.

Thanks a lot in advance for your help.

Greetz,

Dirk
 
You need to use the @@IDENTITY feature

e.g in your stored procedure you can set up a return parameter and set it to the value of @@IDENTITY

see BOL for more info

Andy
 
Thanks Andy, that was indeed what I needed, works perfectly :)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top