I need to store decimals into MySQL, which can have a varying precision. Therefore
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The .net decimal can be different datatypes under the hood.
Warning
Note that according to Jon Skeet,
decimalcan be declared in lots of ways, but will always be aFLOATunder the hood, with all the rounding errors that brings, you have been warned.See: SQL decimal equivalent in .NET
MySQL’s
DECIMALtakes up more space if you assign it a larger precision.From the manual: http://dev.mysql.com/doc/refman/5.5/en/precision-math-decimal-changes.html
The largest number of digits is 65, divided by 9 = 8 bytes, an INT128.