Yorke,
You can do the insert AND select the identity in the same query block:
<CFQUERY NAME="qStuff" DATASOURCE="myDSN">
INSERT INTO tablename (col_1, col_2, col_3)
VALUES ('#form.col_1#', '#form.col_2#', '#form.col_3#')
SELECT @@Identity as thisID FROM tablename
</cfquery>
Then use the ID as required after this:
<cfoutput>ID just inserted: #qStuff.thisID#</cfoutput>
As long as you name your query, you can do this.
Have fun,
Steve C
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Yorke
Hinds
Sent: Thursday, 18 March 2004 10:39 AM
To: CFAussie Mailing List
Subject: [cfaussie] New Record - SELECT @@IDENTITY
Not having used the SELECT @@IDENTITY regularly,
I was wonder if anyone can shed some light on this method
of retrieve the Record ID on INSERT.
DB: Ms SQLServer 2000
All comments & insight welcome!
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to
[EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004