SQL replace dot with comma(SQL用逗号替换点)
问题描述
我有以下代码:
SELECT cast(Listenpreis*1.19 as decimal(29,2)) as Listenpreis
FROM [SL_M03KNE].[dbo].[ARKALK]
我得到这个值:5.59
I get this value: 5.59
我尝试将点替换为 komma,所以我得到了值:5,59
I try to replace the dot to a komma so i get the Value: 5,59
我试试代码:
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?
我发现:如果我做一个
select Artikelnummer,Listenpreis*1.19 as money from [SL_M03KNE].[dbo].[ARKALK]
我得到:5,59
如果我这样做
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
bcp 将 komma 转换为点.我该如何解决这个问题?
the bcp do a conversion from the komma to dot. How can i fixed this?
推荐答案
您的 as Listenpreis
别名位置错误.它必须是最后一件事.还有 '.','
部分.
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 演示
这篇关于SQL用逗号替换点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:SQL用逗号替换点


基础教程推荐
- MySQL 中的类型:BigInt(20) 与 Int(20) 2021-01-01
- 如何根据该 XML 中的值更新 SQL 中的 XML 2021-01-01
- 什么是 orradiag_<user>文件夹? 2022-01-01
- 在多列上分布任意行 2021-01-01
- 表 './mysql/proc' 被标记为崩溃,应该修复 2022-01-01
- 在 MySQL 中:如何将表名作为存储过程和/或函数参数传递? 2021-01-01
- 如何在 SQL 中将 Float 转换为 Varchar 2021-01-01
- oracle区分大小写的原因? 2021-01-01
- 二进制文件到 SQL 数据库 Apache Camel 2021-01-01
- mysql选择动态行值作为列名,另一列作为值 2021-01-01