You need to give your query a name.  Instead <cfquery name="", use <cfquery
name="queryName".  Then you just access that variable as:

queryName.identity

Also, I don't know it it matters to your database or not, but you might want
to put a ; at the end of your first query to differentiate it from the next
... just to avoid confusion.

Todd Ashworth
Web Application Developer
Network Administrator

Saber Corporation
314 Oakland Ave.
Rock Hill, SC 29730
(803) 327-0137 [111] (p)
(803) 328-2868 (f)

----- Original Message -----
From: "Joshua Tipton" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Monday, March 19, 2001 11:32 PM
Subject: @@identity


> I know how to use @@identity to select the last inserted record right
under
> an insert but how do I display that id of that record?
>
> <cfquery name="" datasource="gunledger" dbtype="ODBC">
> INSERT INTO dbo.distrib(compname, phonenum, address, address2, city,
state,
> zip, fflid, expires)
> VALUES('#compname#', '#phonenum#', '#address#', '#address2#', '#city#',
> '#state#', '#zip#', '#fflid#', '#expires#')
> select @@identity as 'identity'
> </cfquery>
>
> How do I output the identity????
>
> Josh
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to