|
Publicité ' | |||||||||||||||||||||||
|
|
#1 | ||
|
Membre du Club
![]() Inscription : mars 2005 Messages : 66 ![]() |
Bonjour
J'ai un problème pour recréer cette table provenant d'une version 3.23 sur une 4.1.15. J'ai l'impression qu'il ne tient pas compte du Disable Key car j'ai une erreur: ERROR 1062 (23000): Duplicate entry '1' for key 1 et qu'il commence à incrémenter la colonne ID à 1, et non à zero. je ne comprends pas pourquoi il ne tient pas compte du disable key. Pouvez-vous m'aider svp ? Merci Code :
|
||
|
|
00
|
|
|
#2 |
|
Membre actif
![]() Inscription : avril 2004 Messages : 208 ![]() |
Bonjour,
Même avec un MySQL 3 les colonnes auto_increment commencent à 1! Si vous mettez 0 c'est la valeur 1 qui sera choisie ou plus si 1 existe déjà. D'où le duplicate key quand vous insérez 1 après avoir voulu inséré 0. Voilà mon avis. Maintenant si vous n'aviez pas de problème avant cela vient surement d'une difference de comportement entre les versions. valeur NULL si valeur incorrect, abscence d'avertissement et tuple erroné ignoré, etc... 8)
__________________
Vous cherchez une Illustratrice ou Infographiste ? http://perso.wanadoo.fr/florence-illustratrice/ Vous cherchez un WebDesigner ? http://www.klerdesign.com |
|
|
00
|
|
|
#3 |
|
Membre du Club
![]() Inscription : mars 2005 Messages : 66 ![]() |
J'ai trouvé une solution: un petit set sql_mode='NO_AUTO_VALUE_ON_ZERO' au début du dump.
NO_AUTO_VALUE_ON_ZERO affects handling of AUTO_INCREMENT columns. Normally, you generate the next sequence number for the column by inserting either NULL or 0 into it. NO_AUTO_VALUE_ON_ZERO suppresses this behavior for 0 so that only NULL generates the next sequence number. This mode can be useful if 0 has been stored in a table's AUTO_INCREMENT column. (Storing 0 is not a recommended practice, by the way.) For example, if you dump the table with mysqldump and then reload it, MySQL normally generates new sequence numbers when it encounters the 0 values, resulting in a table with contents different from the one that was dumped. Enabling NO_AUTO_VALUE_ON_ZERO before reloading the dump file solves this problem. mysqldump now automatically includes in its output a statement that enables NO_AUTO_VALUE_ON_ZERO, to avoid this problem. |
|
|
00
|
|
|
#4 |
|
Membre actif
![]() Inscription : avril 2004 Messages : 208 ![]() |
Bien. Y'a plus qu'à appuyer sur le bouton RESOLU
__________________
Vous cherchez une Illustratrice ou Infographiste ? http://perso.wanadoo.fr/florence-illustratrice/ Vous cherchez un WebDesigner ? http://www.klerdesign.com |
|
|
00
|
Copyright © 2000-2012 - www.developpez.com