If your using sql 7, here's a neat way to do that within a single pair of
cfquery tags:

<cfquery .... >
SET NOCOUNT ON
INSERT INTO Table_Name
( ...... )
VALUES
(........)
select @@identity AS New_Transaction_ID
SET NOCOUNT OFF
</cfquery>

You can now refer to queryname.New_Transaction_ID throught the rest of
your template.

HTH
Brian
----- Original Message -----
From: Chris Lott <[EMAIL PROTECTED]>
To: CF-Talk <[EMAIL PROTECTED]>
Sent: Wednesday, October 04, 2000 3:02 PM
Subject: Last Transaction ID


> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Is there any built-in function that will give me the ID of the most
recent
> database insert? For instance, when the user inserts a new record, I
want
> to immediately retrieve the new record ID for use in a confirmation
message
> and email.
>
> I suppose I can wrap the insert and then a select MAX(id) for that
> particular user in a CFTRANSACTION, but there must be a more elegant
way?
>
> c
> - --
> Chris Lott <[EMAIL PROTECTED]>| IT Manager|p907-474-3494
>
> -----BEGIN PGP SIGNATURE-----
> Version: 6.5.8ckt http://irfaiad.virtualave.net/
>
> iQA/AwUBOduMztaLYehRBGz9EQJIUACfWr2TysaV5wHTvAV4nvjn1Zdo0nAAoPck
> BcMa40G39FpQLcoSJ4nCIiwS
> =YFaI
> -----END PGP SIGNATURE-----
>
>
> -----------------------------------------------------------------------
-------
> Archives: http://www.mail-archive.com/[email protected]/
> To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk
or send a message to [EMAIL PROTECTED] with 'unsubscribe'
in the body.
>

------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to