Concatination in SQL Server

Advertisements

I am getting an error "Error converting data type varchar to numeric"

Select CONCAT('$', '        ', a * 0.05 + b * 12) As value

Variables a and b are having money Data type

>Solution :

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;

Leave a ReplyCancel reply