Back SQL

Get Next AUTO_INCREMENT Value for a Table

WRITTEN BY ON 03 Mar 2014
3,893 VIEWS • SHARES
0 comments

I found this code particularly useful as I always find myself searching for this piece of SQL code during development. I keep forgetting it!

SELECT AUTO_INCREMENT
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = "databaseName"
AND TABLE_NAME = "tableName"
Join the discussion

Comments will be moderated and rel="nofollow" will be added to all links. You can wrap your coding with [code][/code] to make use of built-in syntax highlighter.