麻烦问一下各位就是现在我在数据库里面有一些数据是这样的
00000921000001
00000921000002
00000921000003
00000921000004
00000921000005
00000921000006
。。
依次推下去 数据的话 可能有几十万行就是麻烦问一下  我想把00000921000001  替换成00000924000001
也就是说 把这些数据里面所有的‘921’ 替换成 ‘924’
这个sql应该怎么写啊
在SQLSERVER2000里面谢谢 

解决方案 »

  1.   

    update tablename 
    set colname = regexp_replace(colname,
                               '(0{5})(921)(\d{6})',
                               '\1924\3')
      

  2.   


    update tablename
    set columnname=replace(columnname,'00000921','00000924');
      

  3.   

    先备份表,在替换字符串,
    如表test(a varchar2);
    具体步骤:create table testbak as select * from test;
             truncate table test; 
             insert into test  select REGEXP_REPLACE( a, '1', '924') from testbak2;
             commit;