摔跤狂热30:大家看看这是什么sql 语句?

来源:百度文库 编辑:高校问答 时间:2024/04/28 23:29:00
declare @ptr varbinary(16)
declare @myid int
declare @position int,@len int
set @len=datelength('/image/uploadimg/info/')
declare my_cursor scroll cursor
for
select textptr([content]),id from article
for read only
open my_cursor
fetch next from my_cursor into @ptr,@myid
while @@fetch_status=0
begin

select @position=patindex('%/image/uploadimg/info/%',[content]) from [article] where [id]=@myid
while @position>0
begin
set @position=@position-1
updatetext article_news.[content] @ptr @position @len '/uploadfiles/'
select @position=patindex('%/image/uploadimg/info/%',[content]) from [article] where [id]=@myid
end
close my_cursor
deallocate my_cursor
go

谁能给解释一下
我知道是存储过程,就是不知道什么意思,谁能给个解释或存储过程相关的东西做一下参考

功能:
使用游标把表中content字段中的字符串'/image/uploadimg/info/'
全部替换成'/uploadfiles/'

还有,上面的语句少了个end,在原来end后面再加个end
datelength()是自定义函数,功能大概是和len()函数差不多

mssql的存储过程
可以直接在sql查询分析器里面用的