csv - leading zeros in mysql -


I have a form where the user updates the table in the database with the serial number, the problem is that my . The Csv file serial number has the value of 0 and after inserting it is 000000, is equal to 1, 000001 after inserting it. I really need it as it is in the .csv file. My code for load is:

  Load data local INFILE path_to_file.csv set im_seriennummer character in the table by "latin1" field; IGNORE 1 LINES (sn, description_sn)  

In the .csv file it is like this:

0

1

And in the database

000000

000001

The database contains varchar (16) in the SOP. Is this problem familiar to anyone? Please do not tell me to change the type of field, I have to keep it in mind because some serial numbers are similar to MT 002

The solution, I think, is to use a floating table by importing CSV.

  Make im_seriennummer to show as a temporary table; Load data in Local INFILE path_to_file.csv Table Talkizer Set Latin "1" by field; IGNORE 1 LINES (SN, Description_SEN) UPDATE TREADBAB SET SERIAL = WRITE (CONCAT ('000000', serial), 6) Select IM_Sirinemers * Choose from TitBack Drap Temp Table;  

Comments