3
嗨,我住在奥地利,我们使用,
作为小数点分隔符。使用正确的小数分隔符将浮点数转换为varchar
根据语言/整理设置,使用正确的分隔符将float转换为varchar似乎不可能?
这是一个错误?
set language german --makes no difference in this case
declare @f float = 4.5
select @f --output in my management studio is 4,5
--according to the regional os settings this is correct
select convert(varchar,@f) -- output: 4.5 not correct
一个解决方案,但不理想,我认为
select replace(convert(varchar,@f),'.',',')
那是真的,谢谢, 但你可以转换日期时间有不同的风格,为什么不小数点分隔符? 所以我仍然认为它的错误(或缺少的功能:) :) – 2012-02-16 12:05:45
@ChristophStaudinger:不知道为什么... – gbn 2012-02-16 12:53:00