update 表名 set 字段名=replace(字段名,';',';'+SUBSTRING(字段名,0,LEN(字段名) - CHARINDEX(N'/',REVERSE(字段名))+ 2))
测试效果
declare @str varchar(100)set @str='Images/pic_2001.jpg;pic_2002.jpg;pic_2003.jpg'
select replace(@str,';',';'+SUBSTRING(@str,0,LEN(@str) - CHARINDEX(N'/',REVERSE(@str))+ 2))
--输出
--Images/pic_2001.jpg;Images/pic_2002.jpg;Images/pic_2003.jpg
update product set galleryPath = case when CharIndex('', galleryPath) > 0 then '' else 'Images/' + galleryPath
希望可以帮到你!