i am having hard time determining the length of a Decimal data type. The data i have in column is like 0.08,1.2,12.35,121.36. Now if i go for (2,2) it throws an error : Arithmetic overflow error converting numeric to data type numeric. Just wondering should it be (6,2)? and if yes can anybody tell me Why 6 and 2?
2 Answers
In syntax like
NUMERIC(precision, scale)
precision is the total number of digits (count digits on both sides of the decimal point), and scale is the number of digits to the right of the decimal point.
2 Comments
RB.
@Programmer, so in your example, you would need
Numeric(5,2) to accommodate your longest number 121.36, which has 5 digits, and 2 digits to the right of the decimal point.Mike Sherrill 'Cat Recall'
@RB: At the very least. But the OP also needs to think about what to do with the result of expressions like
3.33 * 5.12 (17.0496).