12.02.2019, 14:50
(
Последний раз редактировалось ComDuck; 12.02.2019 в 16:38.
)
https://www.bram.us/2008/07/30/mysql...fromfor-table/
^ shows what your next AUTO_INCREMENT value will be. Store that in a variable, and write a condition to check the value against your limit.
Besides, AUTO_INCREMENT starts from 1 and not 0 by default. To reset the AUTO_INCREMENT, perform an ALTER request for the table in question:
Even if you change the 1 to a 0, the AUTO_INCREMENT will still be set to 1 unless you modified your server settings to omit the above condition.
EDIT: Why are you doing this, by the way? Can you describe more of your situation?
^ shows what your next AUTO_INCREMENT value will be. Store that in a variable, and write a condition to check the value against your limit.
Besides, AUTO_INCREMENT starts from 1 and not 0 by default. To reset the AUTO_INCREMENT, perform an ALTER request for the table in question:
Код:
ALTER TABLE table_name_here AUTO_INCREMENT = 1
EDIT: Why are you doing this, by the way? Can you describe more of your situation?