Solved

Specifying auto number seed and step values in MySql when using the Create Table command

Posted on 2006-11-18
3
745 Views
Last Modified: 2012-06-22
How can you specify the seed and step values when creating an autonumber using the create table command?

Thanks

Fred
0
Comment
Question by:fred2k3
3 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 125 total points
ID: 17972650
http://dev.mysql.com/doc/refman/5.0/en/create-table.html

you can only specify a starting value (seed), mysql does not support step values different from 1:
create table yourtable ( auto_field  INT AUTO_INCREMENT , .... ) AUTO_INCREMENT = 2

0
 
LVL 30

Expert Comment

by:todd_farmer
ID: 17972779
You actually can control this behavior - but not at the CREATE TABLE level.  You can set server parameters (auto_increment_increment and auto_increment_offset) that control this:

http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html

Obviously, this impacts all tables.

Hope that helps.
0
 

Author Comment

by:fred2k3
ID: 17982369
cheers guys
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now