How to import text file to table with primary key as auto-increment

Posted by webworm on Stack Overflow See other posts from Stack Overflow or by webworm
Published on 2010-03-17T15:28:00Z Indexed on 2010/03/17 15:41 UTC
Read the original article Hit count: 316

Filed under:
|
|

I have some bulk data in a text file that I need to import into a MySQL table. The table consists of two fields ..

  1. ID (integer with auto-increment)
  2. Name (varchar)

The text file is a large collection of names with one name per line ...

(example)

John Doe
Alex Smith
Bob Denver

I know how to import a text file via phpMyAdmin however, as far as I understand, I need to import data that has the same number of fields as the target table. Is there a way to import the data from my text file into one field and have the ID field auto-increment automatically?

Thank you in advance for any help.

© Stack Overflow or respective owner

Related posts about phpmyadmin

Related posts about import