0
I am importing a CVS file into Mysql. I have two columns: a quantidade
and the other as data
. I am trying to convert to Mysql default. In the database this column is as decimal
and date
. You are importing all the records, only these two fields are being saved with 0
in quantidade
and null
as date. I am erring on conversion and not what.
CSV file
nome do material;03B;BC 03;800000235213364;14,000;22/06/2017
nome do material;03B;BC 03;800000235213355;14,000;22/06/2017
nome do material;03B;BC 03;800000235213358;14,000;22/06/2017
nome do material;03B;BC 03;800000235213353;14,000;22/06/2017
Code
mysql_query("LOAD DATA LOCAL INFILE 'C:/wamp/www/transbordo-sap/estoque/Estoque.csv'
INTO TABLE deposito FIELDS TERMINATED BY ';'
OPTIONALLY ENCLOSED BY '\"'
LINES TERMINATED BY '\n'
(Material,Tipo,Posicao,HU,@Qtdd,@Data)
SET Qtdd = REPLACE(REPLACE('@Qtdd', '.', ''), ',', '.'),
Data = STR_TO_DATE(@Data,'%Y-%m-%d')")or die (mysql_error());