help me 我快疯了。。。。。
declare item_cursor cursor for select name_china,jc_val from
open item_cursor -----打开游标
fetch next from item_cursor into @item_n,@item_val0 ------从游标取出检测项目
while @@fetch_status=0 ------循环1
begin (在此处用变量不行,后面把游标赋值到变量@item_val1时候变量值就直接等于列名@item_n,而非记录值,这处该如何写啊?)
declare item_vcursor cursor for select id,@item_n from temp_c -----打开游标
open item_vcursor
fetch next from item_vcursor into @item_id,@item_val1 ------从游标取出检测值
while @@fetch_status=0 ------循环2
begin
if (@item_val0>@item_val1) and (@item_val1<>'-')
begin
update temp_c set @item_n='ok' where id=@item_id
end
fetch next from item_vcursor into @item_id,@item_val1
end
close item_vcursor ---释放item_vcursor
deallocate item_vcursor
fetch next from item_cursor into @item_n,@item_val0
end
close item_cursor ---释放item_cursor
deallocate item_cursor
问题点数:100、回复次数:4Top
1 楼east_asp(强兵)回复于 2005-05-03 19:45:55 得分 50
帮帮忙:
http://community.csdn.net/Expert/topic/3982/3982215.xml?temp=6.901187E-02Top
2 楼orcale()回复于 2005-05-03 20:10:36 得分 30
@item_val1时候变量值就直接等于列名@item_n,而非记录值,这处该如何写啊?)
==>這句話什麼意思不理解?Top
3 楼zjcxc(邹建)回复于 2005-05-03 20:32:34 得分 10
没看懂楼主想做什么?Top
4 楼cywarson(阿胜)回复于 2005-05-03 22:45:16 得分 10
你可能对游标理解上有些错误吧。
怎么就看不太懂你的意思呢。。
你或者可以查一下帮助里中的例子。Top




