Can easily be transformed to one call to the db (if you don't use SPs)
<cfquery name="insertBlah" datasource etc>
INSERT INTO tblBlah
(name, address)
VALUES
('Bill', 'Somewhere Street')
SELECT @@Identity as blahID
</cfquery>
#insertBlah.blahID#
Taco Fleur
Tell me and I will forget
Show me and I will remember
Teach me and I will learn
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf
> Of James Macpherson
> Sent: Thursday, 18 March 2004 9:57 AM
> To: CFAussie Mailing List
> Subject: [cfaussie] RE: New Record - SELECT @@IDENTITY
>
>
> <cftransaction>
>
> <cfquery name="insertBlah" datasource etc>
> INSERT INTO tblBlah
> (name, address)
> VALUES
> ('Bill', 'Somewhere Street')
> </cfquery>
>
> <cfquery name="getIdentity" datasource etc>
> SELECT @@Identity as blahID
> </cfquery>
>
> </cftransaction>
>
> Then you use it in your code:
>
> getIdentity.blahID
>
> etc.
>
> HTH
>
> - J
>
> > -----Original Message-----
> > From: Yorke Hinds [mailto:[EMAIL PROTECTED]
> > 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
---
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