2012年5月2日星期三

ERROR 1063: Incorrect column specifier for column ‘XX’

FROM: PHP Server Side Scripting Forum

I am trying to create a database to calculate my wholesale costs & taxes on the fly, but when I created the database I frogot to make an 'id' column (I use phpMyAdmin to create the tables by hand).

All other fields were created successfully, but I keep gettign this blasted error:

Here's what I'm trying to do:

Field: id
Type: VARCHAR
Length/Values*: 250
Attributes: (empty)
Null: null
Default**: (empty)
Extra: auto_increment


SQL query:
[sql]
ALTER TABLE `wholesale` ADD `id` VARCHAR( 250 ) AUTO_INCREMENT FIRST
[/sql]

很明显,字段 id 指定的字段类型与其属性有冲突。字符型没有 AUTO_INCREMENT 的属性,而如果需要有该属性,则需将字段类型改为整形,具体条件可参看 Using AUTO_INCREMENT.

没有评论:

发表评论