[EMAIL PROTECTED] wrote:

Scott Hamm <[EMAIL PROTECTED]> wrote on 17/09/2004 13:15:30:


mysql> create table list_admin (
   -> admin_id int(11) default '0' not null auto_increment
   -> );
ERROR 1067 (42000): Invalid default value for 'admin_id'

How can I set default value to 0?


I don't think you can have a default with auto-increment. Essentially, auto_increment means "default ++counter", so you are assigning two defaults. Which do you want, 0 or auto_increment?

Alec

Right. You can't have both, because both makes no sense.

Also, if you do want the default to be 0, set it to 0, not to the string '0'. Your admin_id column is an int, not a string.

So, either

  admin_id INT NOT NULL AUTO_INCREMENT

or

  admin_id INT DEFAULT 0 NOT NULL

Michael

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



Reply via email to