请教关于数据库中的光标问题!
lurry 2002-02-27 08:33:28 我在脚本中写了下面的语句,可是在begin和end之间有错误,请高手赐教一二。
declare @word char(500)
declare pass_crsr cursor
for
select word from aaa /*aaa为表名*/
for UPDATE OF word
open pass_crsr
fetch next from pass_crsr into @word
while @@fetch_status = 0
begin
a = len(@word)
for i =2 to a
s = Mid(@word, i, 1)
str_word = str_word & "#" & Asc(s)
next i
update aaa
set word=str_word
where current of pass_crsr
fetch next from pass_crsr into @word
end
deallocate pass_crsr