Jump to content

Archived

This topic is now archived and is closed to further replies.

scott532

Error with Default Value

Recommended Posts

the command line says:
[b]ERROR 1067 (42000): Invalid default value for 'usernumber'[/b]
and i don't get whats wrong with the default '0'
[b]usernumber MEDIUMINT(10) DEFAULT '0' NOT NULL AUTO_INCREMENT,[/b]

Share this post


Link to post
Share on other sites
I don't know... I'm just reading a book that I guess was wrong. I got rid of the default value and set up the tables. Shouldnt it be starting at zero anyhow?

Share this post


Link to post
Share on other sites
Auto increment fields CAN'T have a default falue since they increase on each row added unless specified in the INSERT query.

Share this post


Link to post
Share on other sites
[quote author=JayBachatero link=topic=106340.msg425162#msg425162 date=1157003392]
Auto increment fields CAN'T have a default falue since they increase on each row added unless specified in the INSERT query.
[/quote]
What he said... by default auto inc starts at 1 not 0.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.