CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
花落谁家,你作主! 盛大widget设计大赛英雄榜
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  MS-SQL Server >  基础类

help me 我快疯了。。。。。

楼主qq0757(wins)2005-05-03 17:55:20 在 MS-SQL Server / 基础类 提问

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

相关问题

  • Help me! 我快被气疯了!。。。。
  • 各位大侠,快help me!!
  • help me,help me
  • help me,help me!!!
  • help me,help me !!
  • help me help me
  • help me help me
  • help me ~~~~help me ~~~~help me ~~~~help me ~~~~help me ~~~~
  • help me ,help me ,help,诸位快救救我吧
  • help Me!help Me!HELP ME!!!

关键词

  • 游标
  • vcursor
  • item
  • val
  • 变量
  • 值
  • cursor
  • fetch
  • next
  • temp

得分解答快速导航

  • 帖主:qq0757
  • east_asp
  • orcale
  • zjcxc
  • cywarson

相关链接

  • SQL Server类图书

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo