Use cftransaction tags--
<cftransaction>
1) insert query
2) MAX (id) query
i.e. select max(id) as newid from tablename
</cftransaction>
G <[EMAIL PROTECTED]> wrote:
This will not necessarily work. If a concurrent user has inserted something between the time your process did, and the retrieval, you are not gauranteed to be retreiving the correct row.
either use @@Identity or some sort of unique identifier in the retrieval, such as "max(primarykey) and userid" to ensure you get the last record inserted by THIS user.
Brian
----- Original Message -----
From: Milan Mushran
To: CF-Talk
Sent: Monday, July 26, 2004 10:07 AM
Subject: Re: grabbing the id of an item just entered into DB
SELECT MAX(id) from tablename
Daniel Farmer <[EMAIL PROTECTED]> wrote: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]
- grabbing the id of an item just entered into DB Daniel Farmer
- Re: grabbing the id of an item just entered into D... Alexander Sherwood
- Re: grabbing the id of an item just entered into D... Milan Mushran
- Re: grabbing the id of an item just entered into D... Joe Rinehart
- RE: grabbing the id of an item just entered into D... Eric Creese