0

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 2

3

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.

Sign up to request clarification or add additional context in comments.

2 Comments

@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.
@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).
0

From your examples, should be NUMERIC(5,2) - meaning five numbers in total and 2 after the decimal point.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.