现在有一种需求,比如A列是 abcd.jpg 现在B列想改为abcd.tga,所有记录都这么处理,请问要如何解决呢?

解决方案 »

  1.   

    UPDATE TB
    SET A = REPLACE(A,'jpg',tga)
      

  2.   

    UPDATE TB
    SET A =(SELECT LEFT(A,CHARINDEX(A,'.'))+'tga')
      

  3.   

    update tb set B=replace(A, '.jpg', '.tga')
      

  4.   

    update tb set 
        b=left(a,charindex('.',a))+'tga'
      

  5.   

    UPDATE TB
    SET B = REPLACE(A,substring(A,len(A)-2,3),tga)
      

  6.   

    update tb set 
        b=left(a,charindex('.',a))+'tga'
      

  7.   


    create table test(a varchar(10))
    insert into test
    select '123.jpg' union all
    select '23.jpg'
    go--drop table testupdate test set 
        a=left(a,charindex('.',a))+'tga'select * from testa          
    ---------- 
    123.tga
    23.tga(所影响的行数为 2 行)
      

  8.   

    update tb set b = left(a,len(a) - 3)+'tga'
      

  9.   


    update tb set 
        b=left(a,charindex('.',a))+'tga'