mysql - How to Load amount using LOAD DATA LOCAL INFILE? -
i'm unable load amount using load data local infile have text file there 1 column called 'amount'. problem field has values 20,200.00 , -61,066.11 etc in text file. when try load these values in mysql database, loads 20 , -61. should load full amount in table? using decimal(10,2) data type. using following query. load data local infile 'c:/users/dataction123/desktop/nordic.txt' table spend_nordic lines terminated '\r\n';
load data local infile 'c:/users/dataction123/desktop/nordic.txt' ignore table spend_nordic fields terminated '\t' lines terminated '\r\n' (int_col, @float_col) set float_col = replace(@float_col, ',', '.');
explanation :
mysql casts value column type when reads file, before applying transformations described in set clause. if instruct read variable value handled string beginning. float_col name of field.
for reference click here
Comments
Post a Comment