List:General Discussion« Previous MessageNext Message »
From:Chris Knipe Date:December 11 2009 10:26am
Subject:Re: Update Doesn't Update!
View as plain text  
Quoting carsten@stripped:

> Of course you can have ID=0.

Definately agree

mysql> DESCRIBE test;
+---------+-------------+------+-----+---------+----------------+
| Field   | Type        | Null | Key | Default | Extra          |
+---------+-------------+------+-----+---------+----------------+
| autoinc | int(11)     | NO   | PRI | NULL    | auto_increment |
| value   | varchar(10) | NO   |     | NULL    |                |
+---------+-------------+------+-----+---------+----------------+
2 rows in set (0.00 sec)

mysql> SELECT * FROM test;
+---------+------------+
| autoinc | value      |
+---------+------------+
|       0 | 1234567890 |
+---------+------------+
1 row in set (0.00 sec)

mysql> UPDATE test SET value='a' WHERE autoinc='0';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> SELECT * FROM test;
+---------+-------+
| autoinc | value |
+---------+-------+
|       0 | a     |
+---------+-------+
1 row in set (0.00 sec)

However, what I believe the problem is:
mysql> UPDATE test set value='12345678901' WHERE autoinc='0';
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 1

mysql> SELECT * FROM test;
+---------+------------+
| autoinc | value      |
+---------+------------+
|       0 | 1234567890 |
+---------+------------+
1 row in set (0.00 sec)

the value of value is too long for the varchar(10) in the table.  It  
thus generates the warning, and truncate the field.

The poster's table needs to be updated therefor to accept longer  
variables in the sizes column.


-- 

Regards,
Chris.


Thread
Update Doesn't Update!Victor Subervi11 Dec
  • Re: Update Doesn't Update!carsten11 Dec
    • Re: Update Doesn't Update!Victor Subervi11 Dec
      • Re: Update Doesn't Update!carsten11 Dec
        • Re: Update Doesn't Update!Victor Subervi11 Dec
          • Re: Update Doesn't Update!carsten11 Dec
            • Re: Update Doesn't Update!Victor Subervi11 Dec
  • Re: Update Doesn't Update!Jørn Dahl-Stamnes11 Dec
    • Re: Update Doesn't Update!Victor Subervi11 Dec
    • Re: Update Doesn't Update!Victor Subervi11 Dec
      • RE: Update Doesn't Update!misiaQ11 Dec
    • Re: Update Doesn't Update!carsten11 Dec
      • Re: Update Doesn't Update!Chris Knipe11 Dec
    • Re: Update Doesn't Update!Mark Goodge11 Dec
      • Re: Update Doesn't Update!Johan De Meersman11 Dec
        • Re: Update Doesn't Update!Victor Subervi11 Dec
          • Re: Update Doesn't Update!Johan De Meersman11 Dec
  • Re: Update Doesn't Update!Martijn Tonies11 Dec
  • Re: Update Doesn't Update!Yang Wang11 Dec