ASP Hosting sale!
Double disk space and transfer for FREE!
Limited time offer! Act Now!

aspdev | articles | tutorials | forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to get the newly inserted record ID in SQL Server 2000?

 
Post new topic   Reply to topic    ASPdev.org Forum Index -> ASP programming
View previous topic :: View next topic  
Author Message
crunch



Joined: 10 Nov 2004
Posts: 2

PostPosted: Thu Nov 18, 2004 10:19 am    Post subject: How to get the newly inserted record ID in SQL Server 2000? Reply with quote

Hi guys,

I have ASP page which inserts records in a SQL Server 2000 database. Is there a way to get the unique ID (ID column is identity and primary key) of the newly inserted database table row?



Thanks in advance
Back to top
View user's profile Send private message
paul



Joined: 11 Oct 2004
Posts: 128

PostPosted: Thu Nov 18, 2004 4:17 pm    Post subject: Reply with quote

Hi Crunch,

You can get the newly inserted identity column value with the following T-SQL statement:

Code:

SELECT @@IDENTITY




Paul
_________________
World Countries | Survival Skills
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    ASPdev.org Forum Index -> ASP programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group

SQL Tutorial