Could someone help me clear up some confusion...
I want to put in some decimal values into SQL Server. These decimals can be from 0.0001 to 1.9999
Do I set my data type to:
Decimal(1,4) meaning 1 digit before the point and 4 after
or
Decimal(5,4) meaning 5 total digits with 4 digits after the point.
Thanks!
Decimal(5,4) would be 5 total digits and 4 digits after the point
See this article for more information:
http://msdn.microsoft.com/en-us/library/aa258832(v=sql.80).aspx
p (precision)
Specifies the maximum total number of decimal digits that can be stored, both to the left and to the right of the decimal point. The precision must be a value from 1 through the maximum precision. The maximum precision is 38. The default precision is 18.
s (scale)
Specifies the maximum number of decimal digits that can be stored to the right of the decimal point. Scale must be a value from 0 through p. Scale can be specified only if precision is specified. The default scale is 0; therefore, 0 <= s <= p. Maximum storage sizes vary, based on the precision.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With