Advertisement

05.16.2008 at 08:22AM PDT, ID: 23408613
[x]
Attachment Details

Retrieve primary key after insert

Asked by AlexSD in MS SQL Server, Active Server Pages (ASP)

Tags:

I have an ASP Classic app on SQL 7 (recently migrated from earlier SQL version) and now @@IDENTITY fails (returns NULL).  I have been searching the knowledge base and cannot make heads or tails of the preferred method of primary key retrieval for ASP Classic/SQL 7.  I see lots of talk of SCOPE_IDENTITY and ExecuteScalar() and @@IDENTITY but nothing definitive for our platform.

Our "quick and dirty" for the time being is to simply use "SELECT MAX(key_column)" and hope for the best.

Can anyone direct us on the best method for key retrieval under this platform?Start Free Trial
[+][-]05.16.2008 at 08:29AM PDT, ID: 21583614

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.16.2008 at 01:37PM PDT, ID: 21586256

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: MS SQL Server, Active Server Pages (ASP)
Tags: SQL 7 / ASP Classic
Sign Up Now!
Solution Provided By: angelIII
Participating Experts: 2
Solution Grade: A
 
 
[+][-]09.09.2008 at 12:04PM PDT, ID: 22430919

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628