Change decimal separator in MySQL

杀马特。学长 韩版系。学妹 提交于 2019-11-26 05:37:44

问题


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.


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/8669212/change-decimal-separator-in-mysql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!