-4
  1. Created table 'testload' on demo database (int (15)) http://demo.phpmyadmin.net/master-config/#PMAURL-2:sql.php?db=loadtest&table=testload&server=2&target=&token=b5d7382f24b478d22a2e7435d8f98a3b

  2. Made 'INSERT INTO testload VALUES ('2212533532')'

  3. Got value '2147483647' in 'testload' field.

What am I doing wrong?

3

The value is bigger than the integer number you can put in to int field. The int in mysql is 4 bytes long so the maximum values are -2147483648 and 2147483647. You need to use bigint instead which is 8 bytes long. See mysql documentation

| improve this answer | |
  • Ok, thanks! So, making this field 'unsigned' adds just 1 bit? Urgently changing to bigint type. When I've made int(15) I hoped that 15 will force MySQL to make appropriate field "capacity'... – NikTichy Jul 1 '14 at 11:11
3

2147483647 is the maximum value of a signed 32 bit integer which corresponds to a MySQL INT. 2212533532 is larger than 2147483647 so it is being truncated at the maximum value.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.