[thelist] Using @@Identity

Casey aspnet at thecrookstons.com
Tue Aug 23 19:14:00 CDT 2005

Serdar said:

I didn't catch the beginning of this thread, but have a look at
SCOPE_IDENTITY() , @@IDENTITY is global across the server(?), whilst
SCOPE_IDENTITY is for the current context.

Casey Replied:

Ok, thanks Serdar.  David pointed out the same thing.  I am a convert of
using SCOPE_IDENTITY()  instead of @@IDENTITY, but I just don't know HOW to
use them!!!!!!!!!!!!!!!!!!!

Everything is below....


I was able to get this far (see below) from:


Now I just need to know how to retreive the value of Identity. All this is
being done in ASP.NET using VB and an MS SQL Database.  The colum in
question is doc_id which is set as the auto-incrementing Primary Key.

Dim conAddDoc As SqlConnection = New

Dim strInsert As String = "Insert MCCIME_Doctor (fname, lname, specialty,
...) VALUES (@fname, @lname, @specality, ...) SELECT @@IDENTITY AS

Dim cmdInsert As SqlCommand = NEW SqlCommand(strInsert, conAddDoc)



* * Please support the community that supports you.  * *

For unsubscribe and other options, including the Tip Harvester
and archives of thelist go to: http://lists.evolt.org
Workers of the Web, evolt !

Serdar Kilic

More information about the thelist mailing list