Lucee Equivalent for acf9+ #myResult["GENERATEDKEY"]#

Hi as the topic suggests, i’m looking for an equivalent within lucee 5 for the #queryname["GENERATEDKEY"]# method of pulling sql ident info after an insert.

cf9+ could do the following:

<cfquery datasource="#DSN#" result="myResult">
INSERT INTO MyTable (col1)
VALUES ('col1')
</cfquery>

<cfoutput>Inserted ID is: #myResult["GENERATEDKEY"]#</cfoutput>

is there an equivalent using the cfquery tag?

Thanks very much

is myresult your name attribute or the result attribute for cfquery? It should be the result attribute

posting the actual cfquery code snippet you tried and mentioning the db and lucee version
helps others help you :slight_smile:

ps: you don’t need the quotes, ie #myResult.GENERATEDKEY#

looks like the lucee docs need some updating

1 Like

ahhhh thank you thats exactly what i was doing wrong… the example was correct with result=“myResult” but my code didn’t have it defined… /facepalm.

thanks again!!

1 Like