tags:

views:

24

answers:

1

How to change number comma separation format in mysql from "," to "."
If I have a not fixed length of factorial part of the number.

+3  A: 

Don't do this in mySQL.

Do it on the presentation end, where you output the data.

You can then also take into account possible internationalization settings made by the user (english users getting 1,000, european users getting 1.000 etc...)

Re your comment: There seems to be no native mySQL function to do this. FORMAT() can't change the decimal and thousands separators. A replace like this should work:

SELECT REPLACE(CAST(numericfield AS CHAR), ".", ",") AS numericfield_formatted 

if anybody has a more elegant solution ... fire away.

Pekka
I need an export to a csv file. So, I am using only MySql
Dmitry
@Dmitry I updated my answer.
Pekka