update t set 编号=stuff(编号,1,5,'20111') where 编号 like '20101%'

解决方案 »

  1.   

    update 表  set 字段=replace(字段,'20101','20111')
      

  2.   

    drop table #t1create table #t1(id char(10))
    goinsert into #t1
    select  '20101000'
    union all
    select  '20101001'
    union all
    select  '20101002'
    union all
    select  '20101003'
    goselect * from #t1
    goupdate #t1
       set id = replace(id, '20101', '20111')
     where id like '20101___'
    goselect * from #t1
      

  3.   

    update 表 set 编号='20111' where 编号 like '20101%'
      

  4.   

    编号 应 like '20101___'
    如果用 like '20101%' 可能会出错。 因为 '20120101' 中的 就回被更新为 '20120111'
      

  5.   

    update 表 set 编号=stuff(编号,1,5,'20111') where 编号 like '20101%'
      

  6.   

    2位的都行,只是我没有把一些条件讲述清楚,这些编号都处在Pcode5这个窗格里,我想把里面的编号为20101***的商品的编号,全部变成20111***的编号,后3位不变,依然处在pcode5这个窗格