Show comma instead of point as decimal separator

前端 未结 5 1445
孤城傲影
孤城傲影 2020-12-31 15:30

I just want to get the right number format here in germany, so i need to show commas as decimal separator instead of points. But this...

DECLARE @euros money         


        
5条回答
  •  清歌不尽
    2020-12-31 16:24

    Well, as far as I know, there are no culture-specific options for convert available.

    So you can do it using replaces (yes, it looks a bit ugly...)

    select 
        replace(replace(replace(convert(varchar(30), @euros, 1), ',', '|'), '.', ','), '|', '.')
    

    Idea: first change comma to something, then change dot to comma, and then "something" back to dot.

提交回复
热议问题