on 09-23-2012 11:48 PM
I am from sql server background haven't used a datatype decimal 13,2
what values goes inbto decimal 13,2
please kindly explain.
Thanks a lot for the helpful info.
Hi Rogers,
According to SQL reference manual the decimal data type define as:
DECIMAL(precision, scale) or DEC(p,s)
The DECIMAL(p, s) data type specifies a fixed-point decimal number with precision p and scale s. The precision is the total number of significant digits and can range from 1 to 34.
The scale is the number of digits from the decimal point to the least significant digit and can range from -6,111 to 6,176, which means scale specifies the range of the exponent in the decimal number from 10-6111 to 106176. If scale is not specified, it defaults to 0. Scale is positive when the number has significant digits to the right of the decimal point and negative when the number has significant digits to the left of the decimal point.
Examples: 0.0000001234 (1234 x 10-10) has the precision 4 and the scale 10. 1.0000001234 (10000001234 x 10-10) has the precision 11 and scale 10. 1234000000 (1234x106) has the precision 4 and scale -6.
When precision and scale are not specified, DECIMAL becomes a floating-point decimal number. In this case, precision and scale can vary within the range described above, 1~34 for precision and -6,111~6,176 for scale depending on the stored value.
So, according to your question now, your decimal 13,2 can save value like 1234567890.01, 123456789.00 (means overall 13 digit it accept 11digit before decimal and 2 after it)
Hope it will helpful for you.
-Ruchi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rogers,
Decimal 13,2 represents value will be of length 13 and will be up to 2 decimal places.
for e.g - if u have value 1234567891234.426789
above data type will show you value -1234567891234.43
i hope, this is what you are asking......
Thnkss
Kulwinder
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Kulwinder,
Seems your explanation is in correct.
The DEC Data Type holds total number of digits as defined as precision (including the scale).
That means,
Decimal 13,2 represents Total value will be of length 13 including 2 decimal places.
for e.g:
1. if u have value 1234567891234.426789
above data type will show you value as: 1234567891234
2. if u have value 12345678901.426789
above data type will show you value as: 12345678901.42
(Please correct me if I'm wrong here).
Regards,
Anil.K
User | Count |
---|---|
79 | |
9 | |
9 | |
7 | |
7 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.