开发者

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 probl开发者_如何学Goem 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.....


For your logon in SQL server set default language to something european.


I think you have to change the locale using this

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜