A表里面大概有1000条记录
记录都是这样的
  http://www.abc.com/1.htm
    http://www.abc.com/2.htm
    http://www.abc.com/3.htm
    ......
    http://www.abc.com/*.htm有什么好的办法可以直接把记录里的"http://www.abc.com"改成"http://www.xy.com"呢请朋友们帮帮忙啊
谢谢啦

解决方案 »

  1.   

    update t
    set col1='www.xy'+stuff(col1,1,6,'')
    where 
    col1 like 'www.abc%'
      

  2.   


    方法很多:
    update t
    set col1=stuff(col1,1,7,'www.xy')
    where charindex('www.abc',col1)=1--update t 
    set col1= 'www.xy '+stuff(col1,1,7, ' ') --这里改一下为7个字符
    where  
    col1 like  'www.abc% '
      

  3.   

    楼主可以参照:substring/len/patindex/replace/stuff/left等函数据用法都可以实现
    主要方式两种:替换字符/计算字符
      

  4.   

    declare @t table (id int, name nvarchar(50))
    insert into @t select 1,'http://www.abc.com'
    insert into @t select 2,'http://www.abc.com'
    select * from @t
    update @t
    set name=replace(name,'abc','xy')
    select * from @t
    /*
    id          name
    ----------- --------------------------------------------------
    1           http://www.abc.com
    2           http://www.abc.com(2 行受影响)(2 行受影响)id          name
    ----------- --------------------------------------------------
    1           http://www.xy.com
    2           http://www.xy.com(2 行受影响)*/
    其他函数也可以
      

  5.   


    update tb
    set col = replace(col,'http://www.abc.com','http://www.xy.com')
    --或
    update tb
    set col = replace(col,'.abc.','.xy.')