List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:December 15 2003 4:44am
Subject:Re: integer not being inserted correctly
View as plain text  
At 19:12 -0800 12/14/03, David Griffiths wrote:
>If an INT has a fixed range, then what is the point of giving it scale? As
>in, "int(12)".

That's not a scale.  For integer types, it's a display width.  It has
nothing to do with the allowable range of the underlying data type.

http://www.mysql.com/doc/en/Numeric_types.html

>In Oracle, a NUMBER(12) indicates how many digits you could have (in this
>case, 99999999999 would be the max value).
>
>Would an int(2) allow -99 to 99, or -2147483648 to 2147483647?
>
>Maybe MySQL should throw an error if someone tries to create an int(xyz)
>column that exceeds the size of an int?
>
>David.
>
>
>
>----- Original Message -----
>From: "Dan Nelson" <dnelson@stripped>
>To: "A Pasetti" <ajpasetti@stripped>
>Cc: <mysql@stripped>
>Sent: Sunday, December 14, 2003 6:48 PM
>Subject: Re: integer not being inserted correctly
>
>
>>  In the last episode (Dec 14), A Pasetti said:
>>  > When attempting to insert an integer into an integer column, a
>>  > different value is being inserted for the given row. Check out the
>>  > sql below to see what I mean. The integer 7819359281 is somehow
>>  > changed to 2147483647 when it's inserted.
>>  >
>>  > Perhaps someone has experienced this problem and could suggest a fix.
>>  > I'm using MySQL 4.0.
>>
>>  Use a larger numeric type.
>>
>>  http://www.mysql.com/doc/en/Numeric_types.html
>>
>>  Type      Bytes     From                 To
>>
>>  TINYINT   1         -128                 127
>>  SMALLINT  2         -32768               32767
>>  MEDIUMINT 3         -8388608             8388607
>>  INT       4         -2147483648          2147483647
>>  BIGINT    8         -9223372036854775808 9223372036854775807
>>
>>  --
>>  Dan Nelson
>  > dnelson@stripped


-- 
Paul DuBois, Senior Technical Writer
Madison, Wisconsin, USA
MySQL AB, www.mysql.com

Are you MySQL certified?  http://www.mysql.com/certification/

Thread
integer not being inserted correctlyA Pasetti15 Dec
  • Re: integer not being inserted correctlyDan Nelson15 Dec
  • Re: integer not being inserted correctlyPaul DuBois15 Dec
  • Re: integer not being inserted correctlyDavid Griffiths15 Dec
    • Re: integer not being inserted correctlyDaniel Kasak15 Dec
    • Re: integer not being inserted correctlyPaul DuBois15 Dec
    • RE: integer not being inserted correctlyMike Brando15 Dec
RE: integer not being inserted correctlyCharles E Sweet15 Dec