Get newly created record's ID??

D

David Lozzi

I'm creating new records in my aspx file, but after its created, I need the ID of the new record. The ID field is the primary key and increments automatically. Should this be completed in a proc? Sorry about the cross group post, but I'm not sure where and who would know this.

Thanks!
 
J

Jacco Schalkwijk

You can get the last generated Identity value in your stored procedure with SCOPE_IDENTITY() on SQL Server 2000, and @@IDENTITY on SQL Server 7.

--
Jacco Schalkwijk
SQL Server MVP


I'm creating new records in my aspx file, but after its created, I need the ID of the new record. The ID field is the primary key and increments automatically. Should this be completed in a proc? Sorry about the cross group post, but I'm not sure where and who would know this.

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top