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
posted on 2010-09-30 12:22
sanmao 閱讀(154)
評論(0) 編輯 收藏