The following works in SQL Server.

Place this query immediately after the insert statement.

<cfquery name="Get_Id" datasource="#DSN#" dbtype="ODBC">
     SELECT @@IDENTITY AS my_id
</cfquery>

Phil.

----- Original Message ----- 
From: "Brian Gilbert" <[EMAIL PROTECTED]>
To: "CFAussie Mailing List" <[EMAIL PROTECTED]>
Sent: Wednesday, November 26, 2003 10:12 AM
Subject: [cfaussie] get primary key allocated during insert?


> Hi all,
>
> Is there a way to get the primary key (autonumber) that would be
> allocated during an insert statement in a cfquery?
>
> TIA
>
> Brian
>
> ---
> 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

Reply via email to