zoukankan      html  css  js  c++  java
  • sql之游标


    --select * from   master..sysprocesses
    use test
    declare my_cursor cursor scroll dynamic --scroll表示可以向前或向后移动   dynamic:表示可写也可读,
    for
    select F3 from temp --定义my_cursor 游标

    open my_cursor --打开游标
    declare @name nvarchar(128) --定义一个变量
    fetch next from my_cursor into @name --游标停在第一条记录前面,第一次执行,测试有没有记录存在
    while(@@fetch_status=0) --取数据,直到-2即没有记录
    begin
    print '姓名: ' + @name 
    --fetch next from my_cursor
    fetch next from my_cursor into @name
    end

    --fetch first from my_cursor into @name
    print @name
     --update temp set F9='zzg' where current of my_cursor 
    /* delete from 个人资料 where current of my_cursor */
    close my_cursor
    deallocate my_cursor

  • 相关阅读:
    背景图片填充问题
    a:hover 等伪类选择器
    jQuery中animate()方法用法实例
    响应式框架Bootstrap
    HTTP入门
    jQuery选择器
    httplib urllib urllib2 pycurl 比较
    校招
    JAVA描述的简单ORM框架
    Roman to Integer
  • 原文地址:https://www.cnblogs.com/nickflyrong/p/4759517.html
Copyright © 2011-2022 走看看