There are many times where we want the use the ID of a newly inserted record in the next line of code proceeding an insert on a table with an auto increment field. In CF8 this was available but the result was different depending on the database type. In ColdFusion 9 Adobe solved this issue but using a generic result GENERATEDKEY. All existing results still work in CF9 so existing code wont break but going forward this is a much better way to work and makes your ColdFusion code less database dependent.
Add the result attribute to the < cfquery > block to access the generatedKey
<cfquery name="insertQuery"
result="insertQueryResult">
insert
into
testData
( data )
values ( <cfqueryparam
cfsqltype="cf_sql_varchar" value="Test String" /> )
</cfquery>
<cfdump var="#insertQueryResult.generatedKey#" />
+