Jump to content

Load data from file into table that has autonum primary key


Conjurer

Recommended Posts

How can I update the autonum file when I am loading data from a csv text file?

 

I have Field 2, Field 3, Field 4, etc. in my text file.

 

In the table Field 1 is set up as an autonum Primary key. When I tell it to load the data file using columns 2 - 4 it loads the rows but leaves the first field blank. What would I need to add to the syntax to have it also populate the primary key with the autonum values? :roll:

Make the field auto increment

 

Here is an example taken from the manual

 

CREATE TABLE animals (

            id MEDIUMINT NOT NULL AUTO_INCREMENT,

            name CHAR(30) NOT NULL,

            PRIMARY KEY (id)

            );

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.