Create table w/ DEFAULT setting problems

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ryan

    #1

    Create table w/ DEFAULT setting problems

    I am having problems creating a new table with a default and auto
    increment such as this...

    CREATE TABLE `customer` (
    `cust_id` INT( 5 ) DEFAULT '00000' NOT NULL AUTO_INCREMENT ,
    `cust_name` VARCHAR( 15 ) NOT NULL ,
    `cust_last` VARCHAR( 15 ) NOT NULL ,
    PRIMARY KEY ( `cust_id` ) ,
    INDEX ( `cust_last` ) ,
    FULLTEXT (

    ) CHARACTER SET = latin1


    The error mesg I get is:

    MySQL said:

    #1067 - Invalid default value for 'cust_id'


    If I were to remove the auto increment attribute, it would get created
    fine!?

    Could anyone direct me to where I can find info on this, whethere it
    is syntax related to a step I missed. I know in PostgreSQL, a
    variable has to be set up as an incrementer, and then linked to the
    field where it will be used. Do I need to do anything along those
    lines...

    Thankyou,
    Ryan
Working...