On 10/10/05, Bill Abel <[EMAIL PROTECTED]> wrote: > How do you load data into a table and generate a primary key which > auto increments by 1. > > I want to end up with a primary key value of int 1, 2, 3, 4, and so on. > > My table has three rows, Id (pri_key), Code, Description. I'm loading > data from a text file into the table like this: > > load data local infile 'path_to_myfile.txt' into table sic_codes lines > terminated by '\r' (code, description); > > Currently, the Id gets values of 99897, and then increments by one. > > Any help is appreciated.
Add an auto_increment option to your Id field. -- Greg Donald Zend Certified Engineer MySQL Core Certification http://destiney.com/