--测试 create table tb (a varchar(20),b varchar(10)) insert tb values('XXX/YYY.mp3','') select * from tb update tb set b=substring(a,charindex('/',a)+1,len(a)) select * from tb drop table tb --结果 a b -------------------- ---------- XXX/YYY.mp3 a b -------------------- ---------- XXX/YYY.mp3 YYY.mp3
create table tb (a varchar(20),b varchar(10))
insert tb values('XXX/YYY.mp3','')
select * from tb
update tb set b=substring(a,charindex('/',a)+1,len(a))
select * from tb
drop table tb
--结果
a b
-------------------- ----------
XXX/YYY.mp3 a b
-------------------- ----------
XXX/YYY.mp3 YYY.mp3