List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:December 15 2003 2:53am
Subject:Re: integer not being inserted correctly
View as plain text  
At 18:42 -0800 12/14/03, A Pasetti wrote:
>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.

Have you considered what the maximum value for an INT
column is?

You might want to have a look at this section of the manual:

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

Also, see what the end of this section has to say about
inserting out-of-range values:

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

>
>Perhaps someone has experienced this problem and could
>suggest a fix. I'm using MySQL 4.0.
>
>Your advice will be greatly appereciated.
>
>Thanks,
>
>Andrew Pasetti
>
>*****SQL QUERY RESULTS BELOW*********
>
>mysql> create table TmpPhoneNumbers
>     -> (
>     -> token char(12) not null,
>     -> number int(12) primary key
>     -> );
>Query OK, 0 rows affected (0.05 sec)
>
>mysql> insert into TmpPhoneNumbers (token,number)
>values ('dabw6pz6zkbc',7819359281);
>Query OK, 1 row affected (0.05 sec)
>
>mysql> select * from TmpPhoneNumbers;
>+--------------+------------+
>| token        | number     |
>+--------------+------------+
>| dabw6pz6zkbc | 2147483647 |
>+--------------+------------+
>1 row in set (1.06 sec)


-- 
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