Reply to Re: Why "id int(11) DEFAULT '0'"?

Your name:

Reply:


Posted by Geoff Berrow on 06/09/07 11:30

Message-ID: <qfij63189p1ige0fq2vm5ic7rkgaf0r5o6@4ax.com> from Gilles
Ganault contained the following:

>On Fri, 08 Jun 2007 21:19:11 -0000, ZeldorBlat <zeldorblat@gmail.com>
>wrote:
>>Remove the quotes around 0.
>
>It doesn't work any better:
>
>mysql> CREATE TABLE authlib_data (id int(11) DEFAULT 0 NOT NULL
>auto_increment,age int(3) DEFAULT 0 NOT NULL, PRIMARY KEY (id));
>
>ERROR 1067 (42000): Invalid default value for 'id'

Sheesh, I'm no sql whizz but even I can work out why that is nonsense.
auto_increment works in a similar way as DEFAULT adding a value if one
is not set in the sql except with auto_increment (and the clue is in the
name folks) a new unique number is added to the new row. Having both
must surely conflict and besides, DEFAULT would be redundant


--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация