Ask a Question related to PHP Development, Design and Development.
-
Andreas Emmert #1
Number format German style => English style when importing CSV files into MySQL-DB
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("LOAD DATA LOCAL INFILE '$file' INTO TABLE $data_table
FIELDS TERMINATED BY ';' LINES TERMINATED BY '\r\n' IGNORE 1 LINES;");
Thanks for any help!
---
Andreas
Andreas Emmert Guest
-
CFMX7 Verity: editing style files
Has any kind individual edited the style.* files successfully? I'm on CFMX7, Solaris 2.8 and the same rules as before don't seem to apply i.e.... -
Character style has a little + after style
Sometimes when I try to change some copy to a particular character style, the font won't fully change. Instead I get a small + after the style. How... -
Need help with Style conversion from Style object to Style key/value collection.
I am writing a custom control that derives from the DataGrid control. I would like to apply SelectedItemStyles and ItemStyles for use in my derived... -
Page Number - style i, ii, iii
I have successfully number a section of my document using the Roman numerals and have added a footer to print the page number, but the printed number... -
german version and english xtensions
Hi I want to buy the german version of Director MX 2004. Does the german version work with english xtensions or are there problems with that?... -
Fred #2
Re: Number format German style => English style when importing CSV files into MySQL-DB
Andreas Emmert wrote:
Can't you simply write a 3 or 4-line perl script to convert the file into> 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?
the appropriate format?
-Fred
--
Shameless plug:
[url]http://JobMarketIntelligence.com[/url]
A database of high-tech firms at your fingertips.
Fred Guest
-
Andreas Emmert #3
Re: Number format German style => English style when importing CSV files into MySQL-DB
Good idea, I'll try to do this and run the file through such a filter first
before inserting everything into the database ... simple solutions are best
:)
--
Andreas
"Fred" <fred@jobmarketintelligence.com> schrieb im Newsbeitrag
news:ktu3b.289081$uu5.63240@sccrnsc04...the> Andreas Emmert wrote:
>> > Hi there,
> >
> > I'm trying to import a csv file into my MySQL database. Unfortunatelyor> > 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>> > how can I achieve this?
> Can't you simply write a 3 or 4-line perl script to convert the file into
> the appropriate format?
>
> -Fred
>
> --
> Shameless plug:
> [url]http://JobMarketIntelligence.com[/url]
> A database of high-tech firms at your fingertips.
Andreas Emmert Guest



Reply With Quote

