Hi there,
I'm trying to import a csv file into my MySQL database. Unfortunately the
number format for the price column is formatted in German style, i.e. XX,XX
(decimals separated by comma not by dot). When importing this file using
LOAD DATA LOCAL INFILE the decimals are cut off. I'm using column type FLOAT
for the price column in my database.
Is there any chance to preserve the decimals when importing the csv file
into my database even though the format differs from the one MySQL needs
(dot versus comma)? Is it possible to adjust the query to include this or
how can I achieve this?
My current query looks like this:
$query = mysql_query("LO AD DATA LOCAL INFILE '$file' INTO TABLE $data_table
FIELDS TERMINATED BY ';' LINES TERMINATED BY '\r\n' IGNORE 1 LINES;");
Thanks for any help!
---
Andreas
I'm trying to import a csv file into my MySQL database. Unfortunately the
number format for the price column is formatted in German style, i.e. XX,XX
(decimals separated by comma not by dot). When importing this file using
LOAD DATA LOCAL INFILE the decimals are cut off. I'm using column type FLOAT
for the price column in my database.
Is there any chance to preserve the decimals when importing the csv file
into my database even though the format differs from the one MySQL needs
(dot versus comma)? Is it possible to adjust the query to include this or
how can I achieve this?
My current query looks like this:
$query = mysql_query("LO AD DATA LOCAL INFILE '$file' INTO TABLE $data_table
FIELDS TERMINATED BY ';' LINES TERMINATED BY '\r\n' IGNORE 1 LINES;");
Thanks for any help!
---
Andreas
Comment