Don't use
char
, use FORMAT:
How to Format Numbers as Currency in SQL Server (T-SQL) | Database.Guide[
^]
Quote:
select concat(e.first_name," ",e.last_name)as 'employee name',format(1.15*s.salary,'$99999') as 'No.Of Dollors'
from employees e
join salaries s
on e.emp_no=s.emp_no group by e.emp_no,s.emp_no;
When you are given a link to documentation, read what it says fully...
'$99999' is not a valid format.
When I try FORMAT, it works for me:
DECLARE @SALARY INT = 1000
SELECT FORMAT (@SALARY * 1.15, '$##,###', 'EN-US')
So try that in your SQL, and change the type of @SALARY to match your DB.
When that works - or gives the same error, which it doesn't for me - show us the exact code that generates the problem, or transfer that into your SQL query and try it there.
I'd suspect that your DB contains "odd values" and probably that
s.salary
is not a numeric field.