Yes, it works like that. I believe this is the MySql specific syntax, because we can put the auto_increment anywere in other mysql systems.

Are you the Paul Dubois who wrote "MySql and Perl for the Web"? I purchased that book, but before reading it I'm learning the basics of MySql. Also, if you are the author of this book, notice that the link

hcp://www.kitebird.com/mysql-perl/

no longer works. What is the new web site compagnon for the book?

Thanks
Fandango


From: Paul DuBois <[EMAIL PROTECTED]>
To: "Fandango del Morro" <[EMAIL PROTECTED]>,[EMAIL PROTECTED]
Subject: Re: Big problem with autoincrementing
Date: Sun, 22 Jun 2003 11:37:11 -0500

At 7:35 +0000 6/22/03, Fandango del Morro wrote:
Hello,
I'm new in this list and I also a newbie with MySql. I have a big problem with autoincrementing with an initial value. For example:


use Database Business;
create Table Clients(Client_ID int not null primary key auto_increment=10, Full_Name varchar(30));


Each time I assign an initial value to auto_increment I get an error and worse, the MySql server only tell me there is an error, it doesn't tell me what kind of error is.

I tried at leat 30 times before writing this message. I really unable to solve this problem. auto_increment=n is an accepted syntax and it is documented in all sql books.


I know of no documentation that states you should use the option in the
way you show above.  To set the initial AUTO_INCREMENT value, you use an
AUTO_INCREMENT option *following* the closing parenthesis that ends the
column definitions in the CREATE TABLE statement.

Try this instead:

CREATE TABLE Clients
(
    Client_ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
    Full_Name VARCHAR(30)
) AUTO_INCREMENT = 10;

You can put that all on one line if you like.  I put it on multiple
lines to make it clearer where the table option at the end goes.


Can you explain me why I have this problem?


Thanks
Fandango


--
Paul DuBois, Senior Technical Writer
Madison, Wisconsin, USA
MySQL AB, www.mysql.com

Are you MySQL certified? http://www.mysql.com/certification/


_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail



-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to