C#技术百科
问问你的心你有没有信心 做事情要专一坚定,执着

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
posted on 2008-10-16 15:40  王德田  阅读(222)  评论(0编辑  收藏  举报