SQL replace dot with comma
sql, sql-server, t-sql
Solution
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
Problem
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?