I have following code:
SELECT cast(Listenpreis*1.19 as decimal(29,2)) as Listenpreis
FROM [SL_M03KNE].[dbo].[ARKALK]
I get this value: 5.59
I try to replace the dot to a komma so i get the Value: 5,59
I try the code:
SELECT replace((cast(Listenpreis*1.19 as decimal(29,2)) as Listenpreis),'.','))
FROM [SL_M03KNE].[dbo].[ARKALK]
But something is wrong with the Syntax. Any Ideas?
I found out: if I do a
select Artikelnummer,Listenpreis*1.19 as money from [SL_M03KNE].[dbo].[ARKALK]
i get: 5,59
If i do a
EXEC master..xp_cmdshell 'bcp "select Artikelnummer,Listenpreis*1.19 as money from [SL_M03KNE].[dbo].[ARKALK]" queryout "D:\shop\xml\Artikelpreise_ohne.csv" -E -c -T -x
the bcp do a conversion from the komma to dot. How can i fixed this?
Your as Listenpreis
aliasing is in the wrong place. It needs to be the last thing. Also the '.','
part.
SELECT REPLACE(CAST(Listenpreis*1.19 AS DECIMAL(29,2)) ,'.',',') AS Listenpreis
FROM [SL_M03KNE].[dbo].[ARKALK]
SQLFiddle DEMO
This should work:
select replace(cast(Listenpreis*1.19 as decimal(29,2)),'.',',') as Listenpreis
from [SL_M03KNE].[dbo].[ARKALK]
It does sound like you're compensating for cultural settings, have a look at the COLLATE
statement.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With