如题!!不要叫我手动添加啊,呵呵

解决方案 »

  1.   

    MYSQL?列是什么类型?
    update tt set f1=
    concat('0',f1)
      

  2.   

    mysql> create table test_num(id int(6) zerofill);
    Query OK, 0 rows affected (0.20 sec)mysql> insert into test_num values(203);
    Query OK, 1 row affected (0.02 sec)mysql> select * from test_num;
    +--------+
    | id |
    +--------+
    | 000203 |
    +--------+
    1 row in set (0.00 sec)mysql>
      

  3.   

    update tt set f1=concat('0',f1)
    这样不行?
      

  4.   

    update chinapostalcode set 区号 = concat('0',区号)
    我是这样写的,可是不行,提示说Data too long for column '' at row 1,单引号里乱码了
      

  5.   


    请仔细看我的回由此,使用:id int(6) zerofill 类型即可。mysql> create table test_num(id int(6) zerofill);
    Query OK, 0 rows affected (0.20 sec)mysql> insert into test_num values(203);
    Query OK, 1 row affected (0.02 sec)mysql> select * from test_num;
    +--------+
    | id |
    +--------+
    | 000203 |
    +--------+
    1 row in set (0.00 sec)mysql>
      

  6.   

     (不要高估你的汉语表达能力或者我的汉语理解能力)
       建议你列出你的表结构,并提供测试数据以及基于这些测试数据的所对应正确结果。
       参考一下这个贴子的提问方式http://topic.csdn.net/u/20091130/20/8343ee6a-417c-4c2d-9415-fa46604a00cf.html
       
       1. 你的 create table xxx .. 语句
       2. 你的 insert into xxx ... 语句
       3. 结果是什么样,(并给以简单的算法描述)
       4. 你用的数据库名称和版本(经常有人在MS SQL server版问 MySQL)
       
       这样想帮你的人可以直接搭建和你相同的环境,并在给出方案前进行测试,避免文字描述理解上的误差。   
      

  7.   

    mysql> create table t1(id int(6));
    Query OK, 0 rows affected (0.08 sec)mysql> insert into t1 values(1003);
    Query OK, 1 row affected (0.01 sec)mysql> select * from t1;
    +------+
    | id   |
    +------+
    | 1003 | 
    +------+
    1 row in set (0.00 sec)
    mysql> alter table t1 modify id int(6) zerofill;
    Query OK, 1 row affected (0.04 sec)
    Records: 1  Duplicates: 0  Warnings: 0mysql> select * from t1;
    +--------+
    | id     |
    +--------+
    | 001003 | 
    +--------+
    1 row in set (0.00 sec)mysql> 
      

  8.   

    一开始不行,我之后把varchar长度改设为5后可以了