游标更新某个字段的值

作用:把某字段中的某个值全部替换为另一个值
declare @id int
declare cursorID cursor for select id from T_Video where url like '%http://iilloo.com.cn%'
open cursorID
fetch next from cursorID into @id
while @@fetch_status=0
begin
declare @url varchar(500)
select @url= url from T_Video where id=@id
set @url=replace(@url,'http://iilloo.com.cn','http://127.139.139.237:8082')
update T_Video set url=@url where id=@id
--print(@url)
fetch next from cursorID into @id
end
close cursorID
DEALLOCATE cursorID
posted @ 2011-11-17 18:37  疯狂二十九笔  阅读(163)  评论(0)    收藏  举报