1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to display a number larger than 2147483647

Discussion in 'MySQL' started by peppy, Jun 16, 2010.

  1. #1
    Greetings,

    I am having problems trying to display large numbers in MySQL. It seems that the largest number for an INT column is 2147483647 and the largest number for UNSIGNED is twice this.

    I would like to display numbers as large as 1 Trillion, such as a debt number, fiscal information or the earth's population to an exact figure (no exponents). I also can't turn these numbers into VARCHAR or TEXT because I need to perform mathematics with them.

    Thanks
     
    peppy, Jun 16, 2010 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    Use an unisigned BIGINT. It maxes out significantly higher - 18446744073709551615 is the max value. .
     
    Last edited: Jun 16, 2010
    jestep, Jun 16, 2010 IP
    peppy likes this.
  3. peppy

    peppy Active Member

    Messages:
    389
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    95
    #3
    Excellent! This works great!

    Thanks!
     
    peppy, Jun 16, 2010 IP
  4. ab420

    ab420 Well-Known Member

    Messages:
    417
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    110
    #4
    I remember when I first started learning PHP / MySQL and I ran into that problem over and over... I thought for sure there was some kind of conspiracy involving the number 2147483647 lol.
     
    ab420, Jun 16, 2010 IP