tags:

views:

59

answers:

3

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.....

+1  A: 

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

Arvo
nope doesnt work..doubt it has to do with the setting in SQL2005 or my regional settings tried that...wonder if you guys know a way to convert this results in excel,.,,as in SQL the amount is stored as somethign like this 146275.7000000
You can set Excel decimal separator to different symbol (atleast in Excel 2007). And if you're using Excel, then you could query numeric values directly, without converting them to varchar - avoids regional settings problems.
Arvo
A: 

I think you have to change the locale using this

SET LANGUAGE British English

RageZ
it is in enlish..still same results
@Andreas: sorry what about British English
RageZ
Its not the language guys...nothing to do with it,,i am sort of looking for a function in SQL
A: 

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
lins314159