UPDATE TB SET A =(SELECT LEFT(A,CHARINDEX(A,'.'))+'tga')
update tb set B=replace(A, '.jpg', '.tga')
update tb set b=left(a,charindex('.',a))+'tga'
UPDATE TB SET B = REPLACE(A,substring(A,len(A)-2,3),tga)
update tb set b=left(a,charindex('.',a))+'tga'
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 行)
SET A = REPLACE(A,'jpg',tga)
SET A =(SELECT LEFT(A,CHARINDEX(A,'.'))+'tga')
b=left(a,charindex('.',a))+'tga'
SET B = REPLACE(A,substring(A,len(A)-2,3),tga)
b=left(a,charindex('.',a))+'tga'
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 行)
update tb set
b=left(a,charindex('.',a))+'tga'