SQL游标使用例

来源:互联网 发布:win10装mac系统 编辑:程序博客网 时间:2024/06/04 19:24
Use [test]declare my_cur cursor forselect name,Value from [Result]declare @s nchar(10)declare @a floatdeclare @c floatopen my_curfetch next from my_curinto @s,@a,@cwhile @@fetch_status = 0beginif @c = 2beginupdate [Result] set [Value] = -1 where [Value] = @cendfetch next from my_curinto @s, @a, @cendclose my_curdeallocate my_cur