[导入]修改图片路径的存储过程


alter proc replaceImgPath(@yearmonth varchar(36))
as
begin
declare @sqlone varchar(360)
declare @sqltwo varchar(360)
--exec('select picpath1,replace(picpath1,''/upload/UploadFile/'+@yearmonth+'/'','''') from product where len(picpath1)>0 and  picpath1 like ''%'+@yearmonth+'%''')
---修改路径
set @sqlone='update product set picpath1=replace(picpath1,''/upload/UploadFile/'+@yearmonth+'/'','''') where len(picpath1)>0 and picpath1 like ''%'+@yearmonth+'%'''
exec(@sqlone)
---修改为标准路径
set @sqltwo='update product set picpath1=''/upload/UploadFile/'+@yearmonth+'/''+substring(picpath1,charindex(''/'',picpath1)+1,len(picpath1)) where len(picpath1)>0 and picpath1 like ''%'+@yearmonth+'%'' and len(picpath1)<36' --order by len(picpath1)
exec(@sqltwo)
end
go

文章来源: http://www.cnblogs.com/wangdetian168/archive/2008/10/16/1312703.html

你可能感兴趣的:(html,360,Go)