Figured I would bring this up as I have noticed issues with it in the
past. This is a quote from the microsoft site about the various
current identity functions of sql server.

IDENT_CURRENT is similar to the Microsoft® SQL Server™ 2000 identity
functions SCOPE_IDENTITY and @@IDENTITY. All three functions return
last-generated identity values. However, the scope and session on
which 'last' is defined in each of these functions differ.

    * IDENT_CURRENT returns the last identity value generated for a
specific table in any session and any scope.

    * @@IDENTITY returns the last identity value generated for any
table in the current session, across all scopes.

    * SCOPE_IDENTITY returns the last identity value generated for any
table in the current session and the current scope.

----- Original Message -----
From: Joe Rinehart <[EMAIL PROTECTED]>
Date: Mon, 26 Jul 2004 11:13:50 -0400
Subject: Re: grabbing the id of an item just entered into DB
To: CF-Talk <[EMAIL PROTECTED]>

for sql server:

<cfquery>
SET NOCOUNT ON

INSERT INTO users (firstname)
VALUES ('george')

SELECT @@Identity AS userId

SET NOCOUNT OFF
</cfquery>

-joe

----- Original Message -----
From: Daniel Farmer <[EMAIL PROTECTED]>
Date: Mon, 26 Jul 2004 11:00:00 -0400
Subject: grabbing the id of an item just entered into DB
To: CF-Talk <[EMAIL PROTECTED]>

Hi gang.... I remember hearing something a while back where someone wanted
to grab the id of an item they just entered into the database.... all in one
sql statement.

Does anyone remember the sql for
that?________________________________________________________________
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to