In SQL Server, when I want to execute the following statement, it throws an error
SELECT ROUND(99.9, 0)
It throws this error:
Arithmetic overflow error converting expression to data type numeric
Only 99.9 raises this error, except this, every other value produces a valid result.
What is the reason for this?
Expected result should be
100
ROUNDfordecimal(p, s)is againdecimal(p, s). In your case100.0isnumeric(4, 1), notnumeric(3,1).numeric(4,1)variable or column there's no error. If you usedeclare @num decimal(4,1)=99.9thenSelect Round(@num,0)returns100.0which is anumeric(4,1)value - 4 digits, one fractional