Professional Web Applications Themes

Auto Increment increase by 100 at a time? - MySQL

Hello, 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? Regards, Gary....

  1. #1

    Default Auto Increment increase by 100 at a time?

    Hello,

    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?

    Regards,

    Gary.


    Gary@garywhittle.co.uk Guest

  2. #2

    Default Re: Auto Increment increase by 100 at a time?

    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


    Markus Popp Guest

  3. #3

    Default Re: Auto Increment increase by 100 at a time?

    >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 tion
    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 tion 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
    Gordon Burditt Guest

Similar Threads

  1. Auto increment VALUE attribute extension
    By arzo2000 in forum Macromedia Exchange Dreamweaver Extensions
    Replies: 1
    Last Post: November 11th, 05:55 PM
  2. How to Handle Primary Key Auto Increment?
    By tbemcf14 in forum Coldfusion - Advanced Techniques
    Replies: 2
    Last Post: March 22nd, 09:47 PM
  3. id after auto increment from a form
    By Faith in forum ASP
    Replies: 7
    Last Post: August 6th, 05:18 PM
  4. Auto Increment a number field
    By jaycee in forum Microsoft Access
    Replies: 0
    Last Post: July 30th, 11:22 PM
  5. Howto: Auto increment Primary Key in SQLServer
    By Wali Akthar in forum Microsoft SQL / MS SQL Server
    Replies: 1
    Last Post: July 3rd, 12:23 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139