Created
August 13, 2014 09:47
-
-
Save Kichrum/301815bda8b5958a3f00 to your computer and use it in GitHub Desktop.
AUTO_INCREMENT: getter and setter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Get AUTO_INCREMENT current value: | |
SELECT `AUTO_INCREMENT` | |
FROM INFORMATION_SCHEMA.TABLES | |
WHERE TABLE_SCHEMA = 'DatabaseName' | |
AND TABLE_NAME = 'TableName'; | |
-- SET AUTO_INCREMENT value (this number will be user for NEXT inserted element): | |
ALTER TABLE `TableName` AUTO_INCREMENT = 5; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment