Wednesday, May 22, 2013

MySQL Error - Numeric value out of range: Out of range value for column

If you saw this error, then you're in luck, I found the same and got the oddness sorted out. It's actually pretty simple. There are several reasons for it, but it all boils down to one problem - the action is trying to input a numeric value outside of permitted range as obvious as the error says. Here are cases when this happen.

1. User error. User tries to input a large number from permitted values.

2. AUTO_INCREMENT issue #1. AUTO_INCREMENT value of the table is beyond the range. To fix just do ALTER TABLE <table> AUTO_INCREMENT=<max valid ID>. If you indeed have reached the maximum allowed table   then just alter the table for a wider range i.e int(10) to int(20).

3. AUTO_INCREMENT issue #2. There's a value within the table that is the maximum value allowed. Find that record and delete or modify it i.e DELETE from <table> where <auto_increment field> = <maximum allowed value>. Then finally, do the solution highlighted above (#2).
  • Related Links Widget for Blogspot

No comments: