I have a column that is varchar, and I am trying to convert it to numeric(8,2) to return it like this 1.00, but its returning it like this instead 1.000
Example:
Select
Convert(numeric(8,2),WholesaleCost) * 2.2)
FROM Table
This Returns 50.900
Seems like when I reduce the scale to numeric(8,1) instead of numeric(8,2) it returns how I want it, which is 50.90
Does anyone know why its doing this? Why its adding an additional scale digit to the result? Shouldnt it be 50.9 when i do numeric(8,1)?
Because you are doing
numeric(8,2) * numeric(2,1)and the resultant datatype isnumeric(11,3)When multiplying two
numericnumberse1 * e2the result has precisionp1 + p2 + 1and scales1 + s2as per Precision, Scale, and Length