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.
MySQL ROUND() Function The ROUND() function rounds a number to a specified number of decimal places.
Click File > Options. On the Advanced tab, under Editing options, clear the Use system separators check box. Type new separators in the Decimal separator and Thousands separator boxes. Tip: When you want to use the system separators again, select the Use system separators check box.
SQL Fiddle Demo You can first replace thousand separator comma(,) to a Zero length string (''), and then you can replace Decimal('. ') to comma(',') in the same select statement.
MySQL FORMAT function examples As you see in the result, the de_DE locale use dot (.) for grouping thousand and comma (,) for decimal mark.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With