表table1中字段id值为 '010101*'
现要将该id值转换为数字类型转存入table2select cast(id as signed) from table1;
可以正常执行查出 10101create table table2
(select cast(id as signed) from table1);
报[Err] 1292 - Truncated incorrect INTEGER value: '010101*'
求解!!!!!!!!!!!!

解决方案 »

  1.   

    直接+0mysql> select  '010101*';
    +---------+
    | 010101* |
    +---------+
    | 010101* |
    +---------+
    1 row in set (0.00 sec)mysql> select  '010101*'+0;
    +-------------+
    | '010101*'+0 |
    +-------------+
    |       10101 |
    +-------------+
    1 row in set, 1 warning (0.00 sec)mysql>
      

  2.   

    当您的问题得到解答后请及时结贴.
    http://topic.csdn.net/u/20090501/15/7548d251-aec2-4975-a9bf-ca09a5551ba5.html
    http://topic.csdn.net/u/20100428/09/BC9E0908-F250-42A6-8765-B50A82FE186A.html
    http://topic.csdn.net/u/20100626/09/f35a4763-4b59-49c3-8061-d48fdbc29561.html8、如何给分和结贴?
    http://community.csdn.net/Help/HelpCenter.htm#结帖