auto_increment by value

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
daedalus__
DevNet Resident
Posts: 1925
Joined: Thu Feb 09, 2006 4:52 pm

auto_increment by value

Post by daedalus__ »

i can't figure out how to say this right on google to get an answer

i want to auto_increment a field by 10 every new record. auto_increment 10 starts the auto_increment at 10.

:\ :drunk:
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: auto_increment by value

Post by Weirdan »

If you're willing to accept that all tables would get the same increment step there's server-wide system variable that defines increment step. Be warned though, that there were bugs involving setting this variable to anything but 1.
Anyway, why would you need this?
User avatar
daedalus__
DevNet Resident
Posts: 1925
Joined: Thu Feb 09, 2006 4:52 pm

Re: auto_increment by value

Post by daedalus__ »

yeah i read about that but it isn't a good solution. i don't really need it but there are some places it would be useful.
User avatar
daedalus__
DevNet Resident
Posts: 1925
Joined: Thu Feb 09, 2006 4:52 pm

Re: auto_increment by value

Post by daedalus__ »

man this has to be some kind of joke because sql server, access, and oracle support this feature but i can't find any documentation saying mysql does.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: auto_increment by value

Post by VladSun »

PGSQL supports it too :P

Anyway - what are you trying to do in general? Why do you need an increment step > 1?
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
daedalus__
DevNet Resident
Posts: 1925
Joined: Thu Feb 09, 2006 4:52 pm

Re: auto_increment by value

Post by daedalus__ »

i don't neeeed to. im making an acl and i want each group id number to be in increments of 10. though im sure it will be useful someday.. for something... haha
Post Reply