DB2 set AUTO_INCREMENT value

How To Reset a auto generated Column in DB2 Table

Auto-increment allows a unique number to be generated when a new record is inserted into a table. By default, the starting value for AUTO_INCREMENT is 1, and it will increment by 1 for each new record.

What if you need to reset the number back to 1?
  • ALTER TABLE table_name ALTER COLUMN column_name RESTART WITH 1;
What if you need to bump up the number back to say 9999?
  • ALTER TABLE table_name ALTER COLUMN column_name RESTART WITH 9999;

No comments:

Post a Comment

NO JUNK, Please try to keep this clean and related to the topic at hand.
Comments are for users to ask questions, collaborate or improve on existing.