Change decimal separator in MySQL
Is it possible to change the decimal comma from "." (dot) to other character (comma) in MySQL output? I don't want to use functions like FORMAT
, I just want to use all the queries I normaly use without any modification. I'm looking for some setting (of some variable, locale etc.). I tried to search the manual but without success.
Solution 1:
Tip for CSV exports:
SELECT REPLACE(CAST(prijs_incl AS CHAR), '.', ',')
will give you input that can be used as numeric fields in european excelsheets.
Solution 2:
No, you can't. That's the SQL standard and MySQL complies with it (in that point at least).
The problem is not really with output (as you mention, there are various FORMAT
functions in most DBMSs) but with INSERT
. If you could use comma ,
for example as decimal point (that's common in other locales) which is aslo used as values separator, Inserts would become ambiguous. See my answer in the question: insert-non-english-decimal-points-in-mysql