SQL小数分隔符

时间:2009-11-17 07:16:36

标签: sql

我有这个查询

SELECT LEFT( CONVERT(VARCHAR, CAST(RUNNING_BALANCe AS MONEY), 1), LEN( CONVERT(VARCHAR, CAST(RUNNING_BALANCe AS MONEY), 1)) - 1) 
from load_transaction_history
WHERE  [POSTED_ON] between '2008-06-10' and '2008-06-15' and account_number='12345678'
order by posted_on

现在的问题是ammounts i ger是这样的6,471,538.30然而在欧洲,我希望小数分隔符如此

6.471.538,30 ...有没有办法做到这一点是SQL ...我试过复制粘贴在excel但格式化不起作用.....

3 个答案:

答案 0 :(得分:1)

对于您在SQL Server中的登录,将默认语言设置为欧洲语。

答案 1 :(得分:0)

我认为您必须使用this

更改区域设置

SET LANGUAGE British English

答案 2 :(得分:0)

你总是可以自己替换它们:

SELECT LEFT( REPLACE(REPLACE(REPLACE(CONVERT(VARCHAR, CAST(RUNNING_BALANCe AS MONEY), 1), '.', '$'), ',', '.'), '$', ','), LEN( CONVERT(VARCHAR, CAST(RUNNING_BALANCe AS MONEY), 1)) - 1)
from load_transaction_history
WHERE  [POSTED_ON] between '2008-06-10' and '2008-06-15' and account_number='12345678'
order by posted_on