Jump to content

Load data from file into table that has autonum primary key


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)

            );

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.