原字段内容中包括以下URL(也有可能一字中包括多个类似的URL):http://pic.jinti.com/member/7326419/20096810374579.jpg 
(sql查询符合的条件:select context from list where context like '%http://pic.jinti.com/member/%')更新成:http://pic3.jinti.com/album/20090608/20096810374579.jpg
注:http://pic3.jinti.com/album/和http://pic.jinti.com/member/是固定的

解决方案 »

  1.   


    update list set context=replace(context,'http://pic.jinti.com/member/','http://pic3.jinti.com/album/') where context like '%http://pic.jinti.com/member/%'
      

  2.   

    select replace(context,"http://pic.jinti.com/member/","http://pic3.jinti.com/album/") from list where context like '%http://pic.jinti.com/member/%') 
      

  3.   

    注意:
    7326419/20096810374579.jpg
    更换成20090608/20096810374579.jpg 
      

  4.   

    注意:
    7326419/20096810374579.jpg
    更换成20090608/20096810374579.jpg 7326419是用户ID,更新成20096810374579.jpg文件名的前面的年月日20090608
      

  5.   


    string url=@"http://pic.jinti.com/member/7326419/20096810374579.jpg ";
    url.Replace(@"http://pic.jinti.com/member/",@"http://pic3.jinti.com/album/");
    //方法原形:String.Replace (OldString, NewString);  用NewString 代替string中所有的 OldString 注:如果string中有多个类似的地址也可以用这种方法解决!
      

  6.   

    update list
     set context=
    replace(context,'http://pic.jinti.com/member/7326419',
     'http://pic3.jinti.com/album/20090608')
     where context like '%http://pic.jinti.com/member/%'
      

  7.   


    String str=@"http://pic.jinti.com/member/7326419/20096810374579.jpg";
    Regex objRegex = new Regex(@"(?i)(?<=\/)(\d+)\/(\d{8})(?=\d+\.jpg$)");
    String strReturn = objRegex.Replace(str, "$2/$2");
      

  8.   

    update list set context= replace(context,'http://pic.jinti.com/member/7326419', dbo.Get()) where context like '%http://pic.jinti.com/member/%' 
    或用函数charindex取值/20096810374579.jpg ,再取年月
      

  9.   

    sql查询符合的条件:select context from list where context like '% 
                     http://pic.jinti.com/member/%'id       context
    1        我是中佃人http://pic.jinti.com/member/7326419/20096810374579.jpg中国
    2        粗体http://pic.jinti.com/member/73/20096810374579.jpg是吗?http://pic.jinti.com/member/342342/200941210374579.jpg测试要求更新成:
    id       context
    1        我是中佃人http://pic.jinti.com/album/20090608/20096810374579.jpg中国
    2        粗体http://pic.jinti.com/album/20090610/20096810374579.jpg是吗?http://pic.jinti.com/album/20090412/200941210374579.jpg测试注:http://pic3.jinti.com/album/和http://pic.jinti.com/member/是固定的 
    需要将7326419/20096810374579.jpg 
    更换成20090608/20096810374579.jpg 
    7326419是用户ID,更新成20096810374579.jpg文件名的前面的年月日20090608
      

  10.   

    如果遇到7326419/20091212374579.jpg,
    它标示的是2009年12月12日?还是2009年1月2日?还是2009年12月1日?还是2009年1月21日?
      

  11.   

    select context from list where context like '%http://pic.jinti.com/member/%')
    功能基本实现,以下举个例子供参考,谢谢
     string temp = "xxxxxxxxhttp://pic.jinti.com/member/7326419/20096810374579.jpg";
    string Result=temp.Replace(temp.Substring(temp.LastIndexOf("xxxxxxxxhttp://pic.jinti.com/member/") + "http://pic.jinti.com/member/".Length ), "20090608/20096810374579.jpg");
      

  12.   

    不好意思修改一下
    string temp = "xxxxxxxxhttp://pic.jinti.com/member/7326419/20096810374579.jpg";
    string Result=temp.Replace(temp.Substring(temp.LastIndexOf("http://pic.jinti.com/member/") + "http://pic.jinti.com/member/".Length ), "20090608/20096810374579.jpg");
      

  13.   


    update list 
    set context= 
        REPLACE('http://pic.','pic.','pic3.')
       +REPLACE('jinti.com/member/','member/','album/')
       +left(substring(context,charindex('member',context)+6+len(用户ID)+2,len(context)-(charindex ('member',context)+6+len(用户ID)+1)),6)+'/'
     +substring(context,charindex('member',context)+6+len(用户ID)+2,len(context)-(charindex('member',context)+6+len(用户ID)+1))
    where context like '%http://pic.jinti.com/member/%测试code :
    declare @s varchar(100)
    declare @ID varchar(100)
    set @ID='7326419'
    set @s='http://pic.jinti.com/member/7326419/20096810374579.jpg'
    set @s = REPLACE('http://pic.','pic.','pic3.')+
     REPLACE('jinti.com/member/','member/','album/')+
     left(substring('http://pic.jinti.com/member/7326419/20096810374579.jpg',charindex('member',@s)+6+len(@ID)+2,len(@S)-(charindex('member',@s)+6+len(@ID)+1)),6)+'/'+
     
     substring('http://pic.jinti.com/member/7326419/20096810374579.jpg',charindex('member',@s)+6+len(@ID)+2,len(@S)-(charindex('member',@s)+6+len(@ID)+1))
     print @S