|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I want to create a table with a column which is primary key and auto increment. Now is there any way so that I can specify the starting value? (e.g. it starts from 10000)
|
|
#2
|
|||
|
|||
|
Insert a dummy record with the value of n-1 for the auto-increment field (instead of null) where n is the number you wish for the first record. After a legitimate record has been entered using null, you can delete the dummy record.
MySQL takes the value of the largest field and increments it. If no record exists the largest field is null which is interpreted to be 0. So the first record to be inserted would begin with 1. |
![]() |
| Viewing: Dev Shed Forums > Databases > MySQL Help > Auto Increment Keyword |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|