Ken,
<cfquery datasource="yourdsn" name="myInsert">
INSERT INTO myable (columns)
VALUES(values)
SELECT @@IDENTITY AS lastID
</cfquery>
<cfoutput>#myinsert.lastID#</cfoutput>
On 02/06/06, Ken <[EMAIL PROTECTED]> wrote:
> Hi. I am doing a Insert statement into my db, and immediately after
> the Insert I need to fetch the value of the field ID (Identity).
> I know I could do a Select Max(ID), but how else can I fetch the value
> of the last inserted record? DB: SQL 2000.
> Please help.
>
> - Ken.
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:242029
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54