Michael Jaynes Michael Jaynes - 1 month ago 6
SQL Question

Add a negative symbol to a numeric value

Using SQL 2014 I need to append a negative sign to a list of numeric values. The data are dollar amounts with numerous places behind the decimal point. I did convert the data to numeric(15, 2)

Here is my select statement.

SELECT '-' + convert(15,2), MONEY from TABLE


I am getting the error: Arithmetic overflow error converting varchar to data type numeric.

I tried converting to varchar as well.

select '-' + CONVERT(varchar10), (convert(numeric(15, 2), MONEY)) from
TABLE


I get the same error as above. Any ideas how to accomplish this?

Answer
SELECT -convert(MONEY, 15.2) from TABLE
Comments