2017  Kodetalk | Feedback | Privacy Policy | Terms | About

mysql to know autoincrement value before insertion

I have a requirement where want to generate unique id based on the autoincrement value to perform some operation on mysql procedure. Because sequences are not support by mysql and I am quite new to this database so its little difficult for me to resolve this kind of requirement. Please suggest. Thanks.

You can execute the below query which will obtain the autoincrement value from mysql meta information.

SELECT auto_increment from information_schema.TABLES where TABLE_NAME ='table name';

Answer is