How to find the last identity value inserted in MYSQL

Hello All,


If you are writing an Insert query and what to find out the last inserted ID then here is what you execute to get the last inserted ID.

DECLARE iID INT;
-- Your Insert query goes here and iID will have your last Inserted ID.
SELECT LAST_INSERT_ID() INTO iID;

Hope that helps.

No comments:

Post a Comment