Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [MySQL] Problem z nadaniem indeksów w mysql
Forum PHP.pl > Forum > Przedszkole
dma3
Próbując nałożyć tworzenie indeksów w MySQL
  1. ALTER TABLE 'forum_' ADD INDEX ('id_');



dostaje blad:
Cytat
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''forum_' ADD INDEX (id_)' at line 1


Struktuta tabeli forum_

  1. CREATE TABLE `forum_` (
  2. `id` int(8) NOT NULL AUTO_INCREMENT,
  3. `id_` int(8) NOT NULL DEFAULT '0',
  4. `id_b` int(8) NOT NULL DEFAULT '0',
  5. `status` int(8) NOT NULL DEFAULT '0',
  6. `zablokowany` int(8) NOT NULL DEFAULT '0',
  7. `autor` varchar(255) collate utf8_swedish_ci NOT NULL DEFAULT '',
  8. `temat` text collate utf8_swedish_ci NOT NULL,
  9. `opis` text collate utf8_swedish_ci NOT NULL,
  10. `tresc` text collate utf8_swedish_ci NOT NULL,
  11. `odslony` int(8) NOT NULL DEFAULT '0',
  12. `nowy_temat` int(8) NOT NULL DEFAULT '0',
  13. `ostatni_post` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  14. `ikona` int(255) NOT NULL DEFAULT '0',
  15. `data_dodania` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  16. `data_edycji` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  17. `ip_autora` varchar(30) collate utf8_swedish_ci NOT NULL DEFAULT '',
  18. `html` int(8) NOT NULL DEFAULT '0',
  19. `xcode` int(8) NOT NULL DEFAULT '0',
  20. `emoikony` int(8) NOT NULL DEFAULT '0',
  21. `ip` varchar(50) collate utf8_swedish_ci NOT NULL DEFAULT '',
  22. PRIMARY KEY (`id`)
  23. ) ENGINE=MyISAM AUTO_INCREMENT=20655 DEFAULT CHARSET=utf8 COLLATE=utf8_swedish_ci AUTO_INCREMENT=20655 ;



co robie zle ?

w bazie juz sa rekordy.


a jak daje

  1. ALTER TABLE `forum_c` ADD INDEX `in` ( `id_` ( 8 ) )


dostaje

Cytat
#1089 - Incorrect sub part key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique sub keys
Darti
  1. ALTER TABLE `forum_` ADD INDEX ( `id_` )
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.