zoukankan      html  css  js  c++  java
  • 游标使用模板

    select * from #temp order by viid--测试,查看临时表有什么数据,对应的列名是什么

    DECLARE E1cursor cursor       /* 声明游标,默认为FORWARD_ONLY游标 */
    FOR select viid from #temp order by viid
    OPEN E1cursor                 /* 打开游标 */
    declare @gid int ;
    declare @gid2 int ;
    FETCH NEXT from E1cursor into @gid /* 在循环体内将读取下一行数据,第一次运行读取第一行*/
    WHILE @@FETCH_STATUS = 0      /* 用WHILE循环控制游标活动 */
    BEGIN
        select @gid2=count1 from #temp where viid=@gid
        UPDATE [VotingInfo] SET [number] = @gid2 WHERE id=@gid
        FETCH NEXT from E1cursor into @gid  /* 在循环体内将读取下一行数据,第一次运行读取第一行*/
    END
    CLOSE E1cursor                /* 关闭游标 */
    DEALLOCATE E1cursor           /* 删除游标 */
  • 相关阅读:
    springMVC总结
    spring总结
    dubbo文档
    mysql集群
    JVM-优化
    JVM-GC日志打印
    JVM-垃圾回收
    JVM-问题定位示例
    C++11
    《疯狂的程序员》
  • 原文地址:https://www.cnblogs.com/wyxy2005/p/1776248.html
Copyright © 2011-2022 走看看