Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

v4.10 - Why is this create table illegal?

Status
Not open for further replies.

thedaver

IS-IT--Management
Jul 12, 2001
2,741
US
I cannot figure out what the heck is wrong with either of these two create table queries. Any ideas? It's my first venture into the V4.x series of Mysql, on linux from binary.

mysql> CREATE TABLE account (
-> number int(11) DEFAULT 0 NOT NULL auto_increment,
-> state tinyint(4) DEFAULT '0' NOT NULL,
-> it char(20));
ERROR 1067: Invalid default value for 'number'

mysql> CREATE TABLE account (
-> number int(11) DEFAULT '0' NOT NULL auto_increment,
-> state tinyint(4) DEFAULT '0' NOT NULL,
-> it char(20));
ERROR 1067: Invalid default value for 'number'

 
It may be the "default" clause conflicting with the "auto_increment" clause. Dump "default '0'".

As an addendum, if the "default" clause were necessary, it should have read "default 0" -- the column number is an integer, but you were setting the default to a string. MySQL will do the conversion for you, but those kinds of conversions are known to slow queries.

Want the best answers? Ask the best questions: TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top