Forum Moderators: coopster

Message Too Old, No Replies

Auto Increment with LOAD DATA INFILE

         

thingy

6:36 pm on Jul 1, 2005 (gmt 0)

10+ Year Member



Hi,

I'm using LOAD DATA INFILE to populate a MySQL db table with values from a textfile. The textfile does not have an empty column I can use to add auto increment.

Is there a way to add auto increment without editing the textfile or going back into my table and adding an extra filed for the auto increment after the table has been updated?

Thanks

coopster

6:42 pm on Jul 1, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, thingy.

I usually use the null value (\N) in cases such as this.


When reading data with LOAD DATA INFILE, empty or missing columns are updated with ''. If you want a NULL value in a column, you should use \N in the data file. The literal word ``NULL'' may also be used under some circumstances. See Section 13.1.5, “LOAD DATA INFILE Syntax”.

Resource:
[dev.mysql.com...]

thingy

1:38 pm on Jul 2, 2005 (gmt 0)

10+ Year Member



Thanks Coopster, it worked perfectly!