This is a discussion on Auto Increment increase by 100 at a time? within the MySQL Database forums, part of the Database Forums category; Hello, I would like my Auto Increment ID field, to increase by 100 at a time, as opposed to the ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi,
if you use MySQL 5, you could use a trigger to achieve this (e.g. insert the row and set the new auto_increment value to the next full 100 - don't forget to lock the table to ensure that no one can insert a value in between). As far as I know, this isn't supported directly. Markus |
|
|||
|
>I would like my Auto Increment ID field, to increase by 100 at a time, as
>opposed to the normal 1. Is this possible? If so, how would I go about >achieving this? There is a variable, auto_increment_increment, which does what you want, I think, starting at 5.0.2. It's intended for replication setups, where one master might generate 1, 11, 21, 31, 41, ... and another master might generate 5, 15, 25, 35, 45, ... but I don't think you have to use replication to get it to work. SET @auto_increment_increment = 100; *BUT* it doesn't operate on a table-by-table basis. There's also auto_increment_offset, which determines the first auto_increment value. Gordon L. Burditt |
![]() |
| Thread Tools | |
| Display Modes | |
|
|