Lucee version 5.3.8.206
DB: MS SQL Server
code sample:
INSERT INTO table1 (Id, UserId)
SELECT Id, UserId
FROM table2 WITH (NOLOCK)
output:
test generate key: #LOCAL.qResult.GENERATEDKEY#
Error:
key [GENERATEDKEY] doesn’t exist
Lucee version 5.3.8.206
DB: MS SQL Server
code sample:
INSERT INTO table1 (Id, UserId)
SELECT Id, UserId
FROM table2 WITH (NOLOCK)
output:
test generate key: #LOCAL.qResult.GENERATEDKEY#
Error:
key [GENERATEDKEY] doesn’t exist
Any idea how can we get GENERATEDKEY from cfquery in Lucee? This works in ColdFusion 9
why didn’t you just try dumping the result to see what is returned? it’s IDENTITYCOL btw
I did, but there are only below keys in the result
cached, executionTime, executionTimeNano, RECORDCOUNT, SQL.
Does it need to be an auto-increment value of an identity column?
sure does
Thanks, I tried inserting into a table that would generate auto-increment value for an identity column, it does return both generatedKey and IDENTITYCOL with the same value.