Not yet rated

Problem

Inserting a record by calling a stored procedure in MySQL. Need access to the identity (LAST_INSERT_ID()) of the new record, which is being returned from the sproc..

Solution

Use the result attribute with CFQuery.

Detailed explanation

In CFQuery, use the result attribute to name the stored procedure response, eg myResult. 

Access the identity with myResult.GENERATED_KEY.


+
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.

Report abuse

Related recipes