Solved

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

Posted on 2006-11-18
3
750 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

A lot of articles have been written on splitting mysqldump and grabbing the required tables. A long while back, when Shlomi (http://code.openark.org/blog/mysql/on-restoring-a-single-table-from-mysqldump) had suggested a “sed” way, I actually shell …
Fore-Foreword Today (2016) Maxmind has a new approach to the distribution of its data sets.  This article may be obsolete.  Instead of using the examples here, have a look at the MaxMind API (https://www.maxmind.com/en/geolite2-developer-package). …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

776 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