<CFQUERY name="whatever" dsn="mydsn">
SET NOCOUNT ON
INSERT INTO myTable (myVAL)
VALUES ('#form.val#');

SELECT @@IDENTITY AS NewID;
SET NOCOUNT OFF
</CFQUERY>

This Assumes an Identity field in myTable...

<CFOUTPUT query="whatever">
#NewID#
</CFOUTPUT>


Jeff Garza
Web Developer/Webmaster
Spectrum Astro, Inc.
480.892.8200

[EMAIL PROTECTED]
http://www.spectrumastro.com



-----Original Message-----
From: Kola Oyedeji [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, May 15, 2001 8:42 AM
To: CF-Talk
Subject: OT: @@identidy in sql server 7



Can anyone please remind me how i get the value of a record
which was just inserted into a sql database. I know its called @@identidy.

I had a snippet but i cant find it,Thanks

KOla
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to