代码改变世界

随笔档案-2011年2月21日

游标的用法,记录一下,老是忘记。。。。真是年纪大了

2011-02-21 15:56 by Rainbow, 312 阅读, 收藏,
摘要: declare @autoid intdeclare @username varchar(50)declare @userpwd varchar(32)declare cursor1 cursor forselect autoid,username,userpwd from user_core_temp --这个有几列 你在游标赋值时就能给几个变量赋值open cursor1fetch next from cursor1 into @autoid,@username,@userpwd --对应刚刚出表中select出来的列while @@FETCH_STATUS=0 --游标打开成功begin 阅读全文