0

Possible Duplicate:
Storing very large integers in MySQL

Hello I am creating a browser game and scores can be higher than 11 characters. So I learned that INT can keep informations that are under 11 characters long.

Can I keep them in TEXT format, are there any potential issues and risk if I do that?

Thanks.

Community
  • 1
  • 1
Slavez
  • 229
  • 2
  • 3
  • 12

2 Answers2

0

Yes you can, but first try to use bigint. And yes there is risks, for example you'll have some bugs trying to fetch chars with score > any value, or exact some value

pomaxa
  • 1,740
  • 16
  • 26
0

SEE Here for MYSQL Numeric Data Types

I'll recommend BIGINT but be aware that the maximum value for BIGINT is 9223372036854775807. Make sure you can handle the value from OverFlowing

mysql> SELECT (9223372036854775807 + 1) as Result;
+-------------------------+
| Result                  |
+-------------------------+
|    -9223372036854775808 |
+-------------------------+

in order to enable the operation to succeed in this case, convert the value to unsigned;

mysql> SELECT (CAST(9223372036854775807 AS UNSIGNED) + 1) as Result;
+-------------------------------------------+
| Result                                    |
+-------------------------------------------+
|                       9223372036854775808 |
+-------------------------------------------+
John Woo
  • 258,903
  • 69
  • 498
  • 492