现在SQL数据库NEWS表中,有个path字段(字符型),字段中有很多数据包含了如:2005-2/1、2005-2/2、2005-2/3等这样的记录,我想把这些记录中的2005全部换成2006,其他的不变,这个更新语句怎么写?谢谢

解决方案 »

  1.   

    declare @t table([date] varchar(10))
    insert into @t select '2005-2/3'
    union all select '2005-2/1'
    union all select '2005-2/2'update @t set [date]=replace([date],'2005','2006')
    select * from @t
      

  2.   

    update news set [path]=replace([path],'2005','2006')
      

  3.   

    update news
    set path=replace(path,'2005','2006')
    where charindex('2005',path)>0
      

  4.   

    update tb 
    set pathreplace(path'2005','2006')
      

  5.   

    update tb 
    set path=replace(path'2005','2006')
      

  6.   

    update news set [path]=replace([path],'2005','2006')
      

  7.   

    出现错误:表达式中 'replace' 函数未定义是不是我用access的原因?
      

  8.   

    如果没有的话,那么在access库中如何实现上述功能?汗!
      

  9.   

    update NEWS set path=replace(path,'2005','2006')