How can I avoid getting this MySQL error Incorrect column specifier for column COLUMN NAME?

前端 未结 5 1537
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-06 22:48

How can I avoid getting this MySQL error Incorrect column specifier for column topic_id ?

MySQL Error...

#1063 - Incorrect column spec         


        
5条回答
  •  广开言路
    2021-02-06 23:05

    The auto_increment property only works for numeric columns (integer and floating point), not char columns:

    CREATE TABLE discussion_topics (
        topic_id INT NOT NULL AUTO_INCREMENT,
        project_id char(36) NOT NULL,
        topic_subject VARCHAR(255) NOT NULL,
        topic_content TEXT default NULL,
        date_created DATETIME NOT NULL,
        date_last_post DATETIME NOT NULL,
        created_by_user_id char(36) NOT NULL,
        last_post_user_id char(36) NOT NULL,
        posts_count char(36) default NULL,
        PRIMARY KEY (topic_id)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
    

提交回复
热议问题