![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 510 Pomógł: 1 Dołączył: 27.08.2007 Ostrzeżenie: (0%) ![]() ![]() |
mam tabele w ktorej jest pole id. jest to indeks tabeli oraz dodatkowo automatycznie wypełniany. Gdy tworze tabele numer startowy to 1 i co dodanie nowych danych on sam automatycznie sie wieksza o 1. teraz moje pytanie: czy gdy mam juz jakis tam numer np. 17 moge sobie jakos ustawic, aby zamielin sie np. na 10 i dalej sie sam pisal 11,12,13... ? czy tylko mozna od nowa tabele stworzyc i leciec od 1 ?
|
|
|
![]() |
![]()
Post
#2
|
|
Grupa: Moderatorzy Postów: 36 557 Pomógł: 6315 Dołączył: 27.12.2004 ![]() |
http://dev.mysql.com/doc/refman/5.0/en/alter-table.html
Cytat To change the value of the AUTO_INCREMENT counter to be used for new rows, do this:
ALTER TABLE t2 AUTO_INCREMENT = value; |
|
|
![]()
Post
#3
|
|
Grupa: Zarejestrowani Postów: 510 Pomógł: 1 Dołączył: 27.08.2007 Ostrzeżenie: (0%) ![]() ![]() |
|
|
|
![]()
Post
#4
|
|
Grupa: Moderatorzy Postów: 36 557 Pomógł: 6315 Dołączył: 27.12.2004 ![]() |
czemu zmieniles na 1? Mowiles ze na 10 chcesz. Nie masz w tabeli zadnych rekordow ze zmieniles na 1?
Cytat You cannot reset the counter to a value less than or equal to any that have already been used. For MyISAM, if the value is less than or equal to the maximum value currently in the AUTO_INCREMENT column, the value is reset to the current maximum plus one. For InnoDB, you can use ALTER TABLE ... AUTO_INCREMENT = value as of MySQL 5.0.3, but if the value is less than the current maximum value in the column, no error occurs and the current sequence value is not changed.
|
|
|
![]()
Post
#5
|
|
Grupa: Zarejestrowani Postów: 510 Pomógł: 1 Dołączył: 27.08.2007 Ostrzeżenie: (0%) ![]() ![]() |
to juz wiele wyjasnia (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
|
|
|
![]() ![]() |
![]() |
Aktualny czas: 22.08.2025 - 13:44 |