Reputation: 23
I'm using mysql workbench to management my database (mysql). I need to store a integer value that have more than 20 digits (we have 21 digits). I try to save in Bigint format but its not solve and i'm getting the same error:
mysql error 1264 out of range value for column
What is the best solution to save one integer with 21 digits?
Upvotes: 1
Views: 6268
Reputation: 806
You can make use of decimal datatype
The declaration syntax for a DECIMAL column is DECIMAL(M,D). The ranges of values for the arguments in MySQL 5.1 are as follows:
M is the maximum number of digits (the precision). It has a range of 1 to 65. (Older versions of MySQL permitted a range of 1 to 254.)
D is the number of digits to the right of the decimal point (the scale). It has a range of 0 to 30 and must be no larger than M.
Based on answer MySQL: Size of decimal data type
Upvotes: 1