I am getting an error
Error converting data type varchar to numeric
when I run this code:
SELECT CONCAT('$', ' ', a * 0.05 b * 12) AS value
Variables a
and b
are defined as money
datatype
CodePudding user response:
Try casting the arithmetic expression to text before including it as a parameter in the CONCAT()
function:
SELECT CONCAT('$', ' ', CAST(a * 0.05 b * 12 AS varchar(20))) AS value;