0

I have tried to insert integer like 356361070084127 in mysql table named IMEI. However, while inserting it from excel file it convert these IMEI automatically to 356361070084120 changing last digit to 0. I have used PHPExccel to upload the excel file.

12
  • Check database column type and max integer that it can hold. Commented May 12, 2017 at 7:34
  • I have used the bigint in my mysql database too. But it didnot help either. Commented May 12, 2017 at 7:58
  • Make it unsigned and try. Commented May 12, 2017 at 8:10
  • making it unsigned also didn't solve the problem. Commented May 12, 2017 at 8:24
  • 2
    "Actually I want these numbers to store IMEI no" - don't use a numeric data type for those - those aren't actual numbers. Store them as what they are - strings that happen to consist of numeric digits only. Commented May 14, 2017 at 2:44

1 Answer 1

0

SUGGESTIONS:

  1. Do a "select" in mysql to verify the "bigint" shows as expected in the database.

  2. In "Excel":

    a) select one of the integer values

    b) Navigate to Home > Number

    c) Increase Decimal

I suspect the actual problem is that Excel might be converting the integer to floating point, then rounding the floating point value.

One way to prevent this is to store the value as a "string" instead of "integer" - that way you can store a decimal value that's arbitrarily long.

Here is some additional information:

https://www.cnet.com/forums/discussions/displaying-long-numbers-greater-than-15-char-in-excel-292538/

ADDENDUM: If you want to store an IMEI number ... THEN USE TYPE "STRING"! In the database, and ESPECIALLY in Excel!

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks paualsm4. Converting value to string in excel and bigint to varchat in mysql really solved the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.