This topic describes how to change the type of a sequence that is associated with a table.
You cannot use the
ALTER TABLE statement to change the type of a sequence. You can use the
ALTER TABLE statement to change the start value of a sequence by using the following syntax:
ALTER TABLE <name> ... AUTO_INCREMENT=<start value>
- To change the type of a sequence, you must execute the
SHOW SEQUENCESstatement first. In the information that is returned, you can obtain the name and type of the sequence. Then, you can use the
ALTER SEQUENCEstatement to change the type of the sequence to a new type.
- After a sequence is used, we recommend that you do not change the start value for
the auto-increment column. If you need to change the start value based on your business
requirements, you must analyze the existing sequence values and the rate at which
new values can be generated to ensure that duplicate sequence values cannot be generated.