[英]sql : add euro sign and round the number
I have an application where I can download data to excel file. 我有一个可以将数据下载到Excel文件的应用程序。 The problem is that I need to add euro sigh to some fields.
问题是我需要在某些领域增加欧元的叹息。
I had a simialar problem with date. 我有一个类似的日期问题。 In excel it was 54656434 It changed in normal date after using
convert(varchar,senddate,105)
在Excel中是54656434它在使用
convert(varchar,senddate,105)
后在正常日期中发生了变化
Is there something that looks like that to add euro sign and round it to 2 decimals ??? 是否有看起来像这样的东西才能添加欧元符号并将其四舍五入到小数点后两位?
EDIT: 编辑:
In excel i get the number like 1,55435 I need the output be like € 1,55 在Excel中我得到像1,55435的数字我需要输出像€1,55
This is kind of convoluted... let me know what you think. 这有点令人费解……让我知道您的想法。 Replace
'1,55435'
with your field. 将
'1,55435'
替换为您的字段。
SELECT CONCAT('£', CAST(CAST(1,55435 AS DECIMAL(18,2)) AS CHAR(55)))
I'm in the US, so I'm not sure if decimals can be changed to use commas instead of periods. 我在美国,因此不确定是否可以将小数更改为使用逗号而不是句点。
Edit: Also, try this: SELECT CONCAT('£', FORMAT(1,55365, 2))
. 编辑:另外,请尝试以下操作:
SELECT CONCAT('£', FORMAT(1,55365, 2))
。 Let me know which works. 让我知道哪个可行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.