Using SQL Server you can either do it with a stored procedure or do
something like this.

<CFQUERY ...
SET NOCOUNT ON

INSERT INTO somtable
(columns)
VALUES
(values)

SELECT @@IDENTITY  -- grab the id of the last inserted record into an
identity column

SET NOCOUNT OFF
</CFQUERY>

Mark

-----Original Message-----
From: Matt Eschenbaum [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 23, 2001 4:36 PM
To: CF-Talk
Subject: SQL INSERTS - return ID


Anyone know a trick to return the ID of a record just Inserted into a table?

Sincerely,

Matthew M. Eschenbaum
Allaire Certified Professional
DevTech Inc.
[EMAIL PROTECTED]
206.956.0888
www.dev-tech.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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