I'd like to make a field in MySQL with auto increments from M000000 till M999999.

Does MySQL (or any db tt is) support varchar auto increment ?

Any suggestions to get out of this situation in MySQL ?

    Just use an integer auto_increment field and add the 'M' and the leading zeros using PHP.

      So it'd be:

      field_name int(7) DEFAULT 'M000000' auto_increment zero_fill,

      This way ?

        Well .. no 😉

        What I ment is just store the id as an integer (without the 'M' and the leading zeros) and 'transform' it to your format when you need the id for display or print. You can do this in the SELECT-statement, or do it afterwhile with PHP.

        Hope this helps,

        Stephan

          Write a Reply...