Avatar of pdheady
pdheady

asked on 

mysql wont import 3 digit number correctly from csv file

I have a csv file as such

company_id, clerk_id
7000, 001
7001, 002
7002, 003

Running import works, but the clerk_id's are being written to the column as 1,2,3 vs 001, 002, 003. How can i get it to retain the original data? The clerk id needs to be 3 digits.

The mysql table structure indicates that clerk_id field is set to INT(11) with no attributes.

Why is it doing this?



LOAD DATA LOCAL INFILE '~/import_companies.csv'
INTO TABLE companies
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
(
company_id,clerk_id
);

Open in new window

PHPMySQL Server

Avatar of undefined
Last Comment
pdheady

8/22/2022 - Mon