Get an ID of record after a SQL insert using ColdFusion

Posted by & filed under programming.

When you want to get an ID field of a record that was just inserted, you have to use the code below in ColdFusion.  First you "SET NOCOUNT ON" and process your insert statement.  After the insert, use a select statement like the following "SELECT @@IDENTITY AS varname".  After this you can "SET NOCOUNT OFF". … Read more »