简体   繁体   中英

sql : add euro sign and round the number

I have an application where I can download data to excel file. 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)

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

This is kind of convoluted... let me know what you think. Replace '1,55435' with your field.

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)) . Let me know which works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM