Jump to content


Photo

Load data from file into table that has autonum primary key


  • Please log in to reply
1 reply to this topic

#1 Conjurer

Conjurer
  • Members
  • PipPipPip
  • Advanced Member
  • 107 posts

Posted 03 November 2003 - 03:52 AM

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:

#2 shivabharat

shivabharat
  • Members
  • PipPipPip
  • Advanced Member
  • 371 posts
  • LocationChennai, India

Posted 07 November 2003 - 06:06 AM

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)             );

Knowledge --- Reading Enriches Mind But Sharing Enhances It.[br][br]Note: Before you request help enusre that you have had a look at the tutorials @phpfreaks




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users