简体   繁体   中英

SQL Decimal separator

I have this query

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

Now the problem is that the ammounts i ger are like so 6,471,538.30 however being in Europe, i want the decimal separators like so

6.471.538,30 ...is there a way to do this is SQL...i tried copy paste in excel but formatting doesn't work.....

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

我认为您必须使用更改语言环境

SET LANGUAGE British English

You could always just replace them yourself:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM