?
Solved

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

Posted on 2006-11-18
3
Medium Priority
?
766 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 375 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

What Is Blockchain Technology?

Blockchain is a technology that underpins the success of Bitcoin and other digital currencies, but it has uses far beyond finance. Learn how blockchain works and why it is proving disruptive to other areas of IT.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

777 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