append currency symbol to result of sql query

北城余情 提交于 2019-12-01 18:23:01

you can concatenate it on your projection statement,

In MySQL,

SELECT PayerDate, CONCAT('$', PaymentAmount) PaymentAmount
FROM Payments

In SQL Server,

SELECT PayerDate, '$' + CAST(PaymentAmount AS VARCHAR(15)) PaymentAmount
FROM   Payments

Try this Query

select PayerDate,'$'+convert(varchar,PaymentAmount) as PaymentAmount
from Payments

You could convert PaymentAmount to a string, and prefix it with a dollar:

select  PayerDate
,       '$' + cast(PaymentAmount as varchar(20)) as PaymentAmount
from    Payments
sandeep

The following can be tried:

SELECT 
FORMAT([PayerDate], 'C' 'en-us') AS PayerDate ,
FORMAT([PaymentAmount], 'C', 'en-us') AS 'PaymentAmount' 
FROM Payments
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!