如何update一个字段的值为null??不是空串'',也不是字符串'null'。谁知道???

解决方案 »

  1.   

    update tblname set 字段=null where condition; 直接用常量Null就行了。mysql> select * from t5 where id=20;
    +------+---------------+
    | id   | c1            |
    +------+---------------+
    |   20 | http://123123 |
    +------+---------------+
    1 row in set (0.00 sec)mysql> update t5 set c1=null where id=20;
    Query OK, 1 row affected (0.16 sec)
    Rows matched: 1  Changed: 1  Warnings: 0mysql> select * from t5 where id=20;
    +------+------+
    | id   | c1   |
    +------+------+
    |   20 | NULL |
    +------+------+
    1 row in set (0.00 sec)mysql>
      

  2.   

    update tt set f1=null 
      

  3.   

    发表于:2009-05-19 08:35:193楼 得分:0 
    update tt set f1=null