SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru phantom007's Avatar
    Join Date
    May 2008
    Posts
    752
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Question MySQL: Value does not increment

    Hi All

    I have the value 9223372036854775807 in a bigint datatype field and am trying to increment the value but it does not increment greater than the above value.

    So can someone please suggest me the solution or tell me which datatype should i use that will support me a value greater than 9223372036854775807?

    Code:
    /*DDL Information*/
    -------------------
    
    CREATE TABLE `log_counter` (
      `log_counter` BIGINT(20) DEFAULT '0'
    ) ENGINE=MYISAM DEFAULT CHARSET=latin1

    Thanks

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,338
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by cancer10 View Post
    I have the value 9223372036854775807 in a bigint datatype field and am trying to increment the value but it does not increment greater than the above value.
    that's because this is the maximum number for a signed bigint

    change the table so that this column is defined with UNSIGNED and you can then go twice as high, to 18446744073709551615
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Guru phantom007's Avatar
    Join Date
    May 2008
    Posts
    752
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    What does unsigned mean?

    Thanks

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,338
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by cancer10 View Post
    What does unsigned mean?
    it means negative numbers are not permitted

    please see http://en.wikipedia.org/wiki/Two's_complement
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •